Skip to content

Instantly share code, notes, and snippets.

@zakandrewking
Last active December 13, 2015 23:19
Show Gist options
  • Save zakandrewking/4991183 to your computer and use it in GitHub Desktop.
Save zakandrewking/4991183 to your computer and use it in GitHub Desktop.

The Basics

Install the Mac OS X developer tools, as described here:

http://stackoverflow.com/questions/9329243/xcode-4-4-and-later-install-command-line-tools

Begin Brewing

Install homebrew

ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

Pay attention to responses. You may need to change permissions on a number of directories: sudo chmod 766 a-directory

  • Install the latest version of git, and set up configuration files
brew install git bash-completion

Some useful config settings

# remember password for a while
git config credential.helper 'cache --timeout=3600'
# enable colors
git config --global color.ui true

To enable git auto-completion in bash, add the following to your .bash_profile:

if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
fi
  • Python

The easiest python installation is with homebrew

brew install python

Be careful of this issue, if it's still open: Homebrew/legacy-homebrew#26900

The solution is the following, right after installing python:

pip install -U pip --no-use-wheel

Install cobrapy

pip install cobra

For ME model, be sure to use this version of cobrapy. You can use virtualenv to maintain two versions of cobra on the same machine.

pip install git+https://github.com/SBRG/cobrapy_internal.git

Install a solver. Gurobi and CPLEX offer free academic licenses. CPLEX is faster and more feature-rich, but it's easier to get the Gurobic license.

To use Gurobi with homebrew python, you'll have to follow steps from this thread: https://groups.google.com/forum/#!topic/gurobi/ghzhXNugDxs.

cd /Library/gurobi562/mac64
python setup.py install
cd /usr/local/lib/python2.7/site-packages/gurobipy
# otool -l gurobipy.so # optional
install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python /usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib gurobipy.so

The same steps should work for gurobipy in a virtualenv. You can link to the same libpython2.7.dylib file.

Install libsbml python binding

pip install python-libsbml

Install ipython & ipdb

pip install 'ipython[all]'
pip install ipdb

Install numpy Mountain Lion ships with numpy, but to ensure compatibility, you can upgrade

pip install --upgrade numpy

Install gcc (which includes gfortran)

brew install gcc

Install scipy

pip install scipy

Install sympy 1.7 (1.8 was causing problems)

pip install https://github.com/sympy/sympy/archive/sympy-0.7.1.tar.gz

Install biopython

pip install biopython

Install sklearn

pip install scikit-learn

Install matplotlib Check out matplotlib from source

pip install matplotlib

If that doesn't work (e.g. can't find freetype headers), try this first.

ln -s /usr/local/opt/freetype/include/freetype2 /usr/local/include/freetype

Install pytest (and use it!!; testing matters)

pip install pytest

Install parallel python (pp)

pip install pp
  • PYQT

Install pyqt (for inline ipython plots, code pasting, and more.) This installs qt for you

brew install pyqt

Install dependencies for pyqt

brew install zmq
pip install pyzmq
pip install pygments
  • PostgreSql
brew install postgresql

Initialize the database. Make sure you have ownership of this directory.

initdb /Library/PostgreSQL/data # just do this ONCE

Start the server

pg_ctl start -D /Library/PostgreSQL/data
createdb --owner=my_username ome
psql ome
alter user my_username with password 'my_password';

Also consider downloading (pgAdmin)[http://www.pgadmin.org/].

set PGDATA environment variable in you .bash_profile or .bashrc For hints on the difference: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html I use /Library/PostgreSQL/data/

If you want to support more than the default (on my machine) 20 connections, you need to change the max_connections value in $PG_DATA/postgresql.conf to a higher value. This will also increase the size of the shared memory segment requested during server startup. You may need to change SHMMAX to accomodate (http://www.postgresql.org/docs/current/static/kernel-resources.html). I was able to run 23 connections without increasing SHMMAX. If the server crashes on startup, check you server log file to see if the connections are asking for too much memory on.

Install psycopg2

pip install psycopg2

install PyGreSQL

pip install pygresql

Install glpk 4.39 and pyglpk. Pyglpk is not compatible with some newer glpk versions (I tried 4.48).

brew versions glpk
cd $(brew --prefix)
git checkout a82e823 Library/Formula/glpk.rb # this corresponds to glpk 4.39

Install pyglpk

pip install glpk
  • For the OME framework

Install SqlAlchemy. At the moment, you should download version 0.7.9. Go to http://www.sqlalchemy.org/download.html, download the tar file, extract, and run the setup.py installer in the extracted folder.

sudo python setup.py install

install SimpleJSON

sudo pip install SimpleJSON
  • SSH

http://www.ernieflores.net/osx-page-2/enable-remote-login-to-start-ssh-server-in-osx/

  • web server

install tornado install django : sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in https://github.com/bdarnell/django-tornado-demo

check ports with

brew install nmap
nmap -p 80 host.domain.com

80 is the default http port

other stuff

Install jq for manipulating json from bash

brew install jq

Install neat howdoi script

brew install https://raw.github.com/gleitz/howdoi/master/howdoi.rb

Install tmux

brew install tmux

Install tex, according to this site: http://www.tug.org/texlive/quickinstall.html Add to your .bash_profile:

export PATH=/usr/local/texlive/2012/bin/universal-darwin:$PATH

Install fasd for quickly moving around the file system:

brew install fasd

Then add to your .bash_profile:

eval "$(fasd --init auto)"

Maybe install zsh

brew install zsh

Remap option key: http://stackoverflow.com/questions/11876485/how-to-disable-typing-special-characters-when-pressing-option-key-in-mac-os-x

remote machine (no root access)

Install git

curl -LO http://git-core.googlecode.com/files/git-1.8.1.4.tar.gz
tar -xzvf git-1.8.1.4.tar.gz
cd git-1.8.1.4/
make prefix=/home/z1king/local && make prefix=/home/z1king/local install

Change you .bashrc file to:

export PATH=$HOME/local:$HOME/local/bin:$PATH

it's worth adding the following the .bash_profile, so you can just edit .bashrc

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

Install tmux locally on linux as user If you have root access, I highly suggest using the method presented by knudfl. Otherwise, if you are simply a non-root user (without the ability to gain root access), here are the steps that I used:

Code:

ssh username@server.com
mkdir local
curl -LO http://downloads.sourceforge.net/tmux/tmux-1.7.tar.gz
curl -LO http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
curl -LO https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar xvfz tmux-1.7.tar.gz
tar xvfz ncurses-5.9.tar.gz
tar xvfz libevent-2.0.11-stable.tar.gz
cd libevent-2.0.11-stable
./configure --prefix=$HOME/local
make
make install
cd ../ncurses-5.9
./configure --prefix=$HOME/local
make
make install
cd ../tmux-1.7
./configure CPPFLAGS="-I$HOME/local/include -I$HOME/local/include/ncurses" LDFLAGS="-static -L$HOME/local/include -L$HOME/local/include/ncurses -L$HOME/local/lib"
make

make install DOESN'T WORK, SO DON'T EVEN TRY, also -static makes it so we don't need to dynamically link shared files in $HOME/local/lib meaning exporting a LD shell variable. We can just copy it and run it. Note: that whole long line above is a single command, run it all together!

cp tmux ~/local/bin
export PATH=$HOME/local/bin:$PATH

At this point, you should be able to just type tmux on the command line and have it work. Otherwise, the binary was installed to $HOME/local/bin, and you can run it by changing directories to there. I'd be happy to help or further clarify if the above doesn't work for you. Note that you may need to resolve further dependencies other than the ones I needed to resolve. In that case, you should install all the additional dependencies using the same ./configure --prefix=$HOME/local location.

Clean up

cd
rm -rf tmux-1.7
rm -rf ncurses-5.9
rm -rf libevent-2.0.11-stable

Unraised http://www.linuxquestions.org/questions/linux-software-2/installing-tmux-from-source-as-non-root-user-857098/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment