Setting up Mac OS X

Installing Xcode Developer Tools and its Command Line Tools

  1. Xcode can be found from your Mac OS X installation media, the Mac App Store, or Apple Developer Connection site.
  2. For OS X 10.7 or later, Command Line Tools needs to be installed separately. Download and install it either from Apple Developer Connection site, or from XCode, choose Preferences -> Downloads and then click “install” next to the “Command Line Tools”.

Installing X-Window system

X11 is a software system and network protocol that provides a basis for graphical user interfaces (GUIs) and rich input device capability for Linux/Unix applications. Normally, it will run in the background and, with the exception of an icon on your dock, will be unnoticeable.

  1. Since OS X 10.8, X11.app is not shipped with the OS, and need to be installed from XQuartz or using Homebrew (see below). NOTE: You should NOT set the DISPLAY variable in any system configuration files or the X11 forwarding will be disabled.
  2. The default behavior for X11 applications is to open a xterm terminal at start-up. With the superior features of the Terminal applications, you will be unlikely to have need of this xterm terminal. To disable it, open a Terminal window and enter the following:
    defaults write org.x.X11 app_to_run /usr/bin/true
  3. In the Preferences menu, under the Input tab, make sure “Enable key equivalents under X11” is unchecked. This is going to make any meta-key functions in Emacs work properly. However, the drawback is that none of the Apple functions (such as apple-S for save, or apple-Q to close) will work in your X-window programs. It is a trade-off -- either Emacs works “normally” or the apple functions work “normally” in X-windows. My preference is to have Emacs working since this is a commonly used program, while the apple functions are really just keyboard shortcuts that can all be done a different way.

Package management systems

There exist a few package management systems that port free/open source Unix/Linux software to Mac OS X, including Homebrew, MacPorts, Fink, rudix, stow. Homebrew, MacPorts, Fink are the more popular choices. Use Homebrew if you haven't yet settled on one. Fink builds on Debian's packaging tools and apt-get, and has pre-compiled executables. MacPorts is strongly influenced by BSD's 'ports' system and builds everything from source code. Homebrew makes maximum use of what comes with OS X and does not need root/sudo to install packages. In addition, Homebrew Cask extends support to other OS X applications (such as Chrome) and let you skip the step-by-step installation process. MacPorts and Homebrew are more up to date than Fink, but Fink tends to have more scientific applications.

List of useful packages

Some of the packages (git, numpy/scipy/matplotlib) below come with the Command Line Tools of Xcode, but they are usually not the latest versions.

  • CMake - a cross-platform build system; easier to use than Autotools or writing Makefiles, and will be used as the default build system for the group code
  • GIMP - an open-source program similar to Adobe Photoshop
  • Git - a distributed version control system used to manage code development in our group; you must learn to use it, see Git_Guidelines
  • gnuplot - another plotting program
  • Inkscape - an open-source SVG vector graphics editor
  • MacTeX or TeX Live - the TeX typesetting program, includes latex
  • Sublime Text - A text editor for code, markup and prose

Some people may find the following also useful:

  • Emacs or XEmacs - a customizable text editor
  • Hunspell - a spell-checker program.
  • ImageMagick - a software suite to create, edit, compose, or convert bitmap images
  • NumPy/SciPy/matplotlib/pandas - Python extensions that define numerical array and matrix type and associated basic operations and support advanced math, signal processing, optimization, statistics, plotting and much more
  • Octave - a Matlab-like environment for numerical computation and graphics
  • R - a statistical computing and graphics environment
  • Xmgrace - a program for making scientific graphs

Using Homebrew

  1. Read more on Homebrew's home page, but basically installation is a one-liner
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. To install new packages, simply type “brew install packagename(s)” at the command prompt. To search for a package, use “brew search packagename”.
  3. If you haven't, you can install X11 through Homebrew Cask with:
    brew install cask
    brew cask install mactex xquartz
    brew cask install firefox google-chrome skype sublime-text vlc # choose as you see fit
  4. To install everything at once, use the following command. Keep in mind this will take a long time to complete and will accept the default option for all questions during the installation (remove the “-y” switch to answer each of them yourself).
    brew tap homebrew/x11
    brew tap homebrew/science
    brew install cmake gimp git gnuplot inkscape

Using MacPorts

  1. MacPorts has a “pkg” installer and the instructions for installation are straightforward.
  2. To install new packages, simply type “sudo port install packagename(s)” at the command prompt. To search for a package, use “port search packagename”. The full list of available packages is found on the MacPorts website on the Available Ports page.
  3. To install everything at once, use the following command. Keep in mind this will take a long time to complete and will accept the default option for all questions during the installation.
sudo port install cmake emacs gimp git gnuplot grace hunspell imagemagick inkscape octave py-matplotlib py-numpy py-scipy R texlive

Using Fink

  1. Fink used to also have a binary installer, but as of 03/25/2008 it is not available for Leopard or later OS X versions. You will need to follow the instructions on the Download page on Fink website.
  2. To install new packages, simply type “fink install packagename(s)” at the command prompt. To search for a package, use “fink apropos packagename”. The full list of available packages is found on the Fink Project website on the Packages page.
  3. To install everything at once, use the following command. Keep in mind this will take a long time to complete and will accept the default option for all questions during the installation (remove the “-y” switch to answer each of them yourself).
fink -y install cmake emacs24 gimp2 git gnuplot grace hunspell imagemagick inkscape octave matplotlib-py27 scipy-py27 numpy-py27 r-base texlive
Password: (enter your password)

Visualization software

Install Schrodinger, Jmol, and VMD.

Set up ssh-agent

  • Generate a key pair following the first bullet point under SSH-Agent , and skip the rest.
  • Follow “On MacOS” in GPG-Agent.
  • Add the lines under “Useful common settings”.

Setting up .ssh/config

Follow the steps in Customizing .ssh/config and set up Sharing sessions over a single connection and Host alias. Leave Multi-hop for later when you need it but do keep in mind of this option.

Customizing shell

Follow this part in Setting up Linux.

Customizing Terminal

  1. Open a Terminal window: find the Terminal icon again and double-click to open it. You can add this icon to your dock if you want (I recommend this since you will probably use Terminal more than any other application) by clicking and dragging the icon onto the dock.
  2. Once you have a Terminal window open, go to Terminal -> Preferences -> Settings. On the left is a series of included styles for the Terminal window. These are similar to PowerPoint templates. If you like one of them, simply highlight it and click on Default at the bottom of the list. This will make that style your default Terminal style.
  3. If you are interested in fuller customization, there are several things you can change. Explore the tabs in the Settings menu to see what can be modified. You can change font style and size, text color, bold text color, highlight color, transparency, background color, etc.
  4. To make your terminal function more like a Unix terminal with familiar key functions, I recommend changing the following settings:
    • Shell: where it says: “When the shell exits”, select “Close only if the shell exited cleanly”.
    • Keyboard: Change the following key bindings
    • End: highlight and click on “edit.” Modifier: none. Action: “send string to shell.” Key sequence: type option-ctrl-[ together, then release and type [ followed by F. If you did this successfully, you will see \033[F on the line.
    • Home: highlight and click on “edit.” Modifier: none. Action: “send string to shell.” Key sequence: option-ctrl-[ then [ and H
    • Page down: highlight and click on “edit.” Modifier: none. Action: “send string to shell.” Key sequence: option-ctrl-[ then [ 6 ~
    • Page up: highlight and click on “edit.” Again, the modifier is “none” and the action is “send string to shell.” The key sequence is option-ctrl-[ then [ 5 ~.
    • Shift end: highlight and click on “edit.” Modifier: shift. Action: “scroll to end of buffer.”
    • Shift home: highlight and click on “edit.” Modifier: shift. Action: “scroll to start of buffer.”
    • Shift page down: highlight and click on “edit.” Modifier: shift. Action: “scroll to next page in buffer.”
    • Shift page up: highlight and click on “edit.” Modifier: shift. Action: “scroll to previous page in buffer.”
  5. The various color schemes also serve a purpose. You can create a library of different backgrounds corresponding to different work locations. Most of the work done in our lab involves remote connections to several computers, often multiple connections at the same time. I find the different backgrounds and colors, along with adding fun and interest to my screen, helps me keep straight which computer I am connected to at any given time. You can modify any of the existing color schemes or create your own.
    • In the Shell tab, check the box next to ‘Run command:’ and add the name of an aliased SSH command in the text box. Any time this particular Terminal profile is opened, it will automatically connect to the computer specified in the SSH command. The result will be a differently colored window open with a remote connection to a specific machine.
    • To open these customized windows, select New Window from the Terminal menu bar. A drop down list of the profiles you created will appear. Selecting any of them will open the new window with appropriate connection.

Comments

Comments powered by Disqus