Scott Sheppard writes 'GTK+OSX has released a native Mac OS X Aqua port of the Linux-based GTK+ open source graphical user interface library. GTK+ (GIMP Toolkit) is a popular widget library supporting graphical applications for Linux.
This page provides step-by-step instructions for setting up and optimizing Mac OS X to run several bioinformatics tools. I recently used this procedure to upgrade both my 2011 MacBook Pro (retrofitted with a 480 GB SSD) and the Bond Lab's 2009 Mac Pro (2 quad-core Intel Xeon processors, retrofitted with 32 GB total RAM and 2 SSDs) to run OS X 10.11 (El Capitan).
The procedures I describe are geared towards novice and intermediate users, and if you are not super comfortable at the command line yet you can copy-paste.
Why not just use Linux?
Good question. I use Linux a lot too: I have my laptop set up as a dual-boot with Ubuntu, and the Minnesota Supercomputing Intitute which I often use also runs Linux. In certain situations Linux is unavoidable--that is not a bad thing as much of the popular Linux distributions are open source and most bioinformatics tools are designed for a Linux environment. But OS X is more familiar to many scientists just getting into bioinformatics/genomics, and since, like Linux, OS X is Unix-based, working in OS X can be a good stepping stone towards gaining experience and practice in a Unix-based environment.
This procedure is designed to make OS X behave as closely as possible to Linux so that skills, tools, and pipelines can be more readily transferred to a Linux environment down the road.
Important disclaimers
- This page assumes you have administrator (i.e.
sudo
) privileges. - I am a microbiologist, not a computer scientist or software engineer. It is possible (likely) that some of the steps I describe may be overkill, poorly/inaccurately/incompletely explained, redundant, or sub-optimal. If that's the case, please help me improve this page by submitting a pull request!
- The tools I recommend installing are, therefore, biased towards those used for working with microbial genomes. However, you can (should!) follow theses instructions if you work in another area of genomics/bioinformatics since many popular tools can be installed safely with Homebrew.
- The procedure relies on making a clean installation (NOT an upgrade from an existing OS X) on an empty hard drive. This guarantees that bits of detritus from previous versions don't get carried along and gum up the works. Daniel discovered after several upgrades that OS X had somehow maintained drivers for his early-2000s Palm Pilot. A clean installation guarantees that no programs get installed and no files get transferred without your explicit permission.
- Installation recommendations should NOT be misinterpreted as either implicit or explicit endorsements of certain tools or packages over others. As with any bioinformatics analysis, Vince Buffalo says it best: never trust your tools (or your data). This post simply describes how to install software in a well-controlled, organized fashion and makes no recommendations for use of said software, as no single tool or set of parameters will apply universally to every question or dataset.
Before you begin
Back up all data! This procedure will erase your hard drive so make sure you have a readable copy (ideally, copies) of your important files on a separate disk.
Create bootable OS X installer
Find a USB stick or external hard drive with at least 8 GB capacity, and transfer any important data off of it as this procedure will erase the disk.
From the App Store, download OS X El Capitain but do not begin the installation process. In Finder, open Applications. You should see an app called 'Install OS X El Capitan.' Insert your (bootable) USB stick or external hard drive and open Finder to determine the name of your external disk. If you prefer, you can also erase the disk using Disk Utility and simply select the default 'Untitled' name. The command below assumes the disk is named 'Untitled' but modify as needed. Open Terminal and type: (NOTE: this will erase the disk!):
and replace
/Volumes/Untitled
with the name of your external disk.Install OS X
Reboot the computer and, with your installer disk connected, hold down the Option key. You will see a menu with different boot options. Select the yellow icon labeled 'Install OS X El Capitan.'
When the installer loads, run Disk Utility. Select your internal hard drive and click 'erase.' Give the disk a name, and select GUID partition table and OS X Extended (Journaled). When the command completes, quit Disk Utility.
Select 'Install OS X' from the menu and select your hard disk (i.e. the one you just erased and reformatted) as the installation target. The system will reboot and eventually ask you for configuration/preferences. DO NOT transfer any files at this time.
Disable System Integrity Protection
El Capitan comes with a feature called System Integrity Protection, which locks down several low-level operating system directories (such as
/usr
) from being written to, even with root access. This becomes important later when installing things like Perl modules as root, for example. You can disable SIP at any time; however, it's best to get it out of the way before we begin installing anything. To disable SIP:- Reboot the computer and hold down Option + R. This will boot into Recovery Mode.
- From the Utilties menu, open Terminal and type
Then reboot the computer.
Prepare the OS for Homebrew
- In System Preferences --> Energy Saver, uncheck 'turn off hard disks whenever possible' and slide the 'put computer to sleep' bar to 'never.' (Some software installations take > 10 minutes and this guarantees that they will complete.) Once software is installed, you can re-adjust Energy Saver options to your liking.
- Install OS updates from App store.
- Install Xcode from the App store (be patient as it can take several minutes).
- Launch Xcode and agree to the terms and conditions.
- Install the command line developer tools. Open Terminal and type
xcode-select --install
. - Install XQuartz. Go to http://www.xquartz.org and download the latest version. The installer will guide you through the setup process (be patient).
- Install the latest Java SE Runtime Environment (JRE). Go here and click on 'JRE download', then select
jre-8u66-macosx-x64.dmg
. Download and run the installer. - Install the latest Java Development Kit (JDK). Go here and click on 'JDK download', then select
jdk-8u66-macosx-x64.dmg
. Download and run the installer. - Install legacy Java (v. 1.6). This version is required to run Artemis as well as older versions of the Adobe Creative Suite. It will not conflict with your existing Java 1.8 installations. Click here and click on the 'Download' button, then run the installer.
- Open TextEdit. You will use TextEdit to modify some plain text files below, so you will need to change preferences for it to behave properly. Under 'Format', select 'plain text'. Uncheck all boxes except 'check spelling as you type'. On the 'Open and Save' tab, uncheck 'add .txt extension to plain text files'. Quit TextEdit.
- Reboot.
![Python Python](/uploads/1/2/5/8/125865548/289643901.png)
Install Homebrew
Homebrew is a wonderful package manager for OS X. Most Linux distributions ship with package managers that oversee proper installation (and uninstallation) of software, and Homebrew behaves similarly on OS X. Open a Terminal and type
Enter your administrator password when prompted.
Verify Homebrew
To learn more about Homebrew's features, type
brew help
or man brew
. The following are some of the most common commands:Optional: Upgrade bash
Upgrading bash will get you on par with the versions shipped with the latest Linux distributions, and should be at least more on par with versions you might encounter on compute clusters. OS X ships with version 3.2; the latest is version 4.3.
Now we have
bash
in two places: /bin/bash
(default OS X, version 3.2) and /usr/local/bin/bash
(Homebrew, version 4.3). We need to tell the system that we want the more recent bash version as our default shell:Finally, we need to tell the system that the new bash is an acceptable shell for the system to use:
Add the following line to the end of the file:
Save the file and quit TextEdit.
Create a bash profile
Now that Homebrew is installed, we want to use Homebrew to install other software such as the GNU flavors of certain shell commands. To do this, we need to tell
bash
where to look for these executables by modifying our $PATH
variable. On OS X, we need to create a file called .bash_profile
in our home directory (~
):The
.bash_profile
contains user-specific configuration for your bash
shell sessions (on Linux, it is called ~/.bashrc
). You can make it as simple or complex as you wish; however, if you want to be able to invoke any program from anywhere on your computer, you must explicitly append your $PATH
variable in your .bash_profile
. It can also be useful to alias certain long or frequently executed commands to simpler ones. My .bash_profile
is provided here for some examples.This reference describes how to install GNU core utilities and how to set your
.bash_profile
to call GNU commands before the default BSD flavors of the same commands that ship with OS X. In TextEdit, add these lines to your .bash_profile
:The
edit
and rc
aliases are optional but helpful, and you can call them whatever you want. The man
alias should be left alone, as it makes sure to call the appropriate man
page for GNU commands. Make sure the file ends with a blank line and save the file. In terminal, typeFrom this point forward, you can accomplish the same command (because we have it aliased) by typing
to tell
bash
to refresh itself with the settings you just added to your .bash_profile
.Install GCC
Apple's C/C++ compiler is called
clang
and is aliased to gcc
, which means that any time you need to compile source C/C++, clang
will run by default. Unfortunately, many programs will fail to build with clang
and instead need the GNU Compiler Collection (gcc
). We can install GNU gcc v. 6.1 with Homebrew:Some programs won't compile with the latest version of
gcc
, but fortunately homebrew allows us to install multiple versions of the same thing:Be patient as each step can take 30-60 minutes to complete the
make bootstrap
step. This installs the latest GNU gcc
with OpenMP support. It does not erase or replace Apple's default clang
installation; instead, GNU gcc
can be invoked as necessary to compile certain programs.Install GNU core utilities
Edit your
~/.bash_profile
and add the following:Installing
findutils --with-default-names
causes a brew doctor
error about certain packages failing to build. We can silence this error by installing GNU findutils
commands with a g
prefix, and simply alias the GNU commands to their default names.Install/upgrade other utilities
Xcode now includes Perl 5.18 and so it is not necessary to
brew install perl
unless you specifically need the latest version (5.24 as of 2016-06-27).