MAC 101: An Introduction

This is an introduction to the things that you should know about your new Mac.

In this section we discuss how to properly setup your Mac, how to SSH onto a remote computer, and more.

What your MAC should have

Your MAC already comes with pre-installed packages, but some of the packages that you may need are not entirely ready to be used. The first packages that you may need to install are the following:


Xcode is an editor that you can use to edit and run your scripts.


In my opinion, Sublime Text is a much better editor than Xcode is, because it has a lot more integrations and feautures than Xcode does.

After having downloaded and installed Xcode, there are a few commands that need to be run in order to let other programs run, i.e. Xcode Command-line Tools.

You should run the following commands from the Terminal:

and verify that you’ve installed Xcode Command Line Tools successfully:

Just to be certain, verify that gcc is installed:

$ gcc --version
gcc-7 (Homebrew GCC 7.2.0) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

For more information, read this to know more about Xcode Command Line Tools.


Another important package that you need to install whenever you get a new MAC is LaTeX. LaTeX is a document preparation system that lets you present your work or documents in a presentable format. LaTeX is also used a lot by scientific journals, i.e. Astrophysical Journal, Monthly Notices of the Royal Astronomical Society.

To download LaTeX on a MAC, you need to download MacTEX. This can be found at

After downloading the necessary .pkg file, you will be able to execute and run LaTeX on your computer.

For a tutorial on how to use LaTeX, go to the links in LaTeX.

Vanderbilt VPN

Sometimes you will need to access remote servers from outside Vanderbilt. To do this you will need to set up a VPN connections. In order to do this, you will need to install the Pulse Secure VPN client. This will will let you connect remotely to servers hosted at Vanderbilt .

MAC Time Machine & Backup

When you get a MAC, you have the option to set up Time Machine. Time Machine lets you back up your entire computer, so that you don’t loose any important file.

I strongly suggest buying a hard drive (>1TB) to back up all of your files. I find the hard drives from Western Digital quite useful. In case you’re interested, see here.


It is extremely important that you back up your computer at least a few times a week. If not, you may end up loosing a substantial amount of files (and your work!) if your computer fails. So this should be one of the first things that you do when having a Mac.


For most of the research being done in graduate school, one needs to access a remote computer that have more processors, more disk space than your computer. For this, you can SSH onto a remote computer via the terminal.

In order to do that, you first need to do the following in the terminal

  • SSH folder
$ cd $HOME
$ mkdir .ssh
$ chmod 700 .ssh
  • SSH Configuration file
$ cd ~/.ssh
$ touch config
$ chmod 600 config
  • Authorized_keys file
$ cd ~/.ssh
$ touch authorized_keys
$ chmod 700 authorized_keys
  • Connections Folder
cd ~/.ssh
mkdir connections
chmod 700 connections
  • SSH-Keys Folder
cd ~/.ssh
mkdir ssh_keys
chmod 700 ssh_keys
  • Public Keys Folder
cd ~/.ssh
mkdir pub_keys
chmod 700 pub_keys

At this point, your ~/.ssh folder should look like this:

$ ls -lah ~/.ssh

drwx------    8 user  staff   256B Jan 21 18:37 ./
drwxr-xr-x@ 161 user  staff   5.0K Jan 21 20:24 ../
-rw-------@   9 user  staff   288B Jan 21 18:37 authorized_keys
-rw-------@   1 user  staff   1.4K Jan 21 19:03 config
drwx------    2 user  staff    64B Jan 22 16:37 connections/
drwx------    2 user  staff    64B Jan 22 16:37 pub_keys/
drwx------    2 user  staff    64B Jan 22 16:37 ssh_keys/

Now you can access a remote computer by logging in from the terminal:


The tedious thing about this is that it will prompt you for your password anytime that you want to access the remote server.

This can be solved by using SSH keys.


Some servers are configured to accept encryption keys in addition to (or instead of) requiring a password. This can be more secure since the account cannot be compromised by someone guessing passwords!

SSH keys are comprised of a public and a private key. The public key can be given to anyone (hence the name). If you connect to a server that has your public key and you can provide your private key, it will let you in. (Consequently, if your private key is stolen, someone else can log into your account!)

In order to generate SSH keys, you need to run the following:

$ cd ~/.ssh
$ ssh-keygen -t rsa -b 4096
$ Generating public/private rsa key pair.
Enter file in which to save the key (/Users/calder/.ssh/id_rsa): id_rsa_4096
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
$ ls
$ chmod 600 id_rsa*
$ mv id_rsa_4096 ssh_keys/
$ mv pub_keys

Now you can add your SSH-Keys by typing the following:

ssh-add -K ~/.ssh/ssh_keys/*


The argument -K in ssh-add for adding the key to your Keychain if you are on a MacOSX system. If not, just have the command ssh-add ~/.ssh/ssh_keys/* to add all of the SSH-KEYS that you have created.

From now on, you should add the private keys and their respective public keys to the ssh_keys and pub_keys folders, and then run the commands chmod 600 key and chmod 600 command, replacing key with the name of the actual SSH-key.


If you enter a passpharase, you will need to type that password every time you use the ssh keys (e.g. when connecting to a server). It’s common to not create a password, but know that if the private key is lost, anyone can use them. (But they would have to know which server to connect to, which “config” file will provide!)

SSH Config file

This file acts as the file with predefined options for how you connect to numerous SSH servers.

After having created the config file in the ~/.ssh directory, you must add the information to each of the servers that you connect to.

First, you must execute

open ~/.ssh/config

in order to open the ~/.ssh/config file. After having opened the file, you can add global settings for how each SSH sessions executes. Add these lines to your config file:

Host *
ControlMaster auto
ControlPath ~/.ssh/connections/%C
ControlPersist 1m
ServerAliveInterval 30
ServerAliveCountMax 10

If you’re on a MAC and would like to use X11 as well, add these extra lines beneath ServerAliveCountMax:

XAuthLocation /opt/X11/bin/xauth
AddKeysToAgent yes
UseKeychain yes

This will ensure that your connections don’t die, forward X11, and save those keys to your Keychain (if applicable).

Connecting to Github

Once you have your ~/.ssh/config file setup, you can add your Github information to it.

You would just need to add this below the code from above:

User git
IdentityFile ~/.ssh/ssh_keys/github_key
IdentitiesOnly yes
PreferredAuthentications publickey

This will make git to use the public key github_key, which you should have created already. If not, follow these instructions here.

Forwarding X11 (MACs only)

If you happen to plot on remote servers, you might want to use XQuarts (X11) if you’re on a Mac in order to plot. If so, you will need to add the following line to the ~/.ssh/config file below the Host information for the server.

ForwardX11 yes

And make sure that the XAuthLocation setting is pointing to the correct path of xauth. This will guarantee that you don’t a problem with rerouting your plots to X11. For more information, see XQuartz.

Your ~/.ssh/config file should look something like this now:

Host *
ControlMaster auto
ControlPath ~/.ssh/connections/%C
ControlPersist 1m
ServerAliveInterval 30
ServerAliveCountMax 10
XAuthLocation /opt/X11/bin/xauth
AddKeysToAgent yes
UseKeychain yes

## Connects to Github
User git
IdentityFile ~/.ssh/ssh_keys/github_key
IdentitiesOnly yes
PreferredAuthentications publickey

## Connects to a remote Server via SSH
Host server_name
User username
IdentityFile ~/.ssh/ssh_keys/server_key
IdentitiesOnly yes
PreferredAuthentications publickey
ForwardX11 yes

where server is the name of the server to which you want to connect, and is the URL to the server. This will use the ~/.ssh/ssh_keys/server_key SSH key to access the server with your credentials for username username.