When I got my new computer for work, I realized I had to reinstall and set up everything that had taken me years to curate on my old computer. And … turns out I have a really custom setup. Here are the steps I took to install everything I need to get started.
gitat the Terminal and mac OS Sierra knows you’re a coder and installs tools for you)
When I can, I prefer to use the interactive Python debugger (
ipdb) over the
pdb. For example, when debugging
dobby instead of running
python -m pdb
dobby/cli.py, I’ll run
python -m ipdb dobby.cli.py. To make
useful, I really like using these aliases which are super helpful to navigate
the stack trace and print the variables you have around.
# Ned's .pdbrc from https://stackoverflow.com/questions/1623039/python-debugging-tips # Print a dictionary, sorted. %1 is the dict, %2 is the prefix for the names. alias p_ for k in sorted(%1.keys()): print "%s%-15s= %-80.80s" % ("%2",k,repr(%1[k])) # Print the instance variables of a thing. alias pi p_ %1.__dict__ %1. # Print the instance variables of self. alias ps pi self # Print the locals. alias pl p_ locals() local: # Next and list, and step and list. alias nl n;;l alias sl s;;l # Short cuts for walking up and down the stack alias uu u;;u alias uuu u;;u;;u alias uuuu u;;u;;u;;u alias uuuuu u;;u;;u;;u;;u alias dd d;;d alias ddd d;;d;;d alias dddd d;;d;;d;;d alias ddddd d;;d;;d;;d;;d
Copy the above text into the clipboard and paste it into your
with one command:
pbpaste > ~/.pdbrc
pbpaste stands for “Pasteboard” paste, which takes the contents of your
clipboard so you can use it on the command line. There’s also
you can pipe
stdout into the clipboard, e.g. to paste your
cat ~/.pdbrc | pbcopy
PyCharm is a fantastic IDE for Python
developers. It’s excellent in part because it leverages the entire JetBrains
ecosystem, which has great plugins e.g. for Markdown and
plugins=(git osx python)
# Uncomment the following line to enable command auto-correction. ENABLE_CORRECTION="true" ... more options ... # Preferred editor for local and remote sessions # Changed to `emacs` if [[ -n $SSH_CONNECTION ]]; then export EDITOR='vim' else export EDITOR='mvim' fi ... more options ... # ssh export SSH_KEY_PATH="~/.ssh/rsa_id"
Add alias for Triton Supercomputing Cluster (TSCC):
# Alias to Triton Supercomputing Cluster (TSCC) alias tscc="ssh firstname.lastname@example.org"
# >:) alias vim=emacs alias vi=emacs
sshkey to GitHub
cat .ssh/id_rsa.pub | ssh email@example.com 'cat >> .ssh/authorized_keys'
Here are my personal preferences for setting up the terminal in Mac OS.
Side Note: Mac OS Sierra’s high contrast I-beam is on point. I’ve lost that cursor so many times in El Capitan.
emacs: Preferences > Settings > Keyboard > Use option as meta key
Installing scientific Python packages from scratch is a pain and you will lose
weeks of your life setting up your
LD_LIBRARY_PATH and hunting down Math
Kernel Libraries (if you’re really interested, check out
this blog post). Enter the
Anaconda Python Distribution, which makes
installing math-heavy python a total breeze.
~/.zshrcsince Anaconda doesn’t know you use
source activate kvector-env conda install ipykernel python -m ipykernel install --user --name myenv --display-name "Python 3.6 (kvector-env)"
Homebrew is the “missing package manager” for Mac OS. It
lets you install software from the command line in an
sudo apt-get-like way
like you can do in Linux systems! It’s super useful.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Here are all the programs I installed. For all of them, you install them with
brew install commandname, e.g.
brew install hub for the command
hubwhich a command line wrapper for git that lets you do pull requests and such from the command line!
GitHub access token token
for command line access so you can do
hub pull-request on the command line.
To save this personal access token securely so you’ll never have to type in
your password for the command line again, you need to do two things:
➜ manuscript git:(master) git config --global credential.helper osxkeychain
olgabot) and the token as th1e password. From now on, your computer should remember your token
➜ manuscript git:(master) git push -u origin master Username for 'https://github.com': olgabot Password for 'https://firstname.lastname@example.org': Counting objects: 636, done. Delta compression using up to 8 threads. Compressing objects: 100% (273/273), done. Writing objects: 100% (636/636), 174.08 KiB | 0 bytes/s, done. Total 636 (delta 350), reused 636 (delta 350) remote: Resolving deltas: 100% (350/350), done. To https://github.com/singlecell-batches/manuscript.git * [new branch] master -> master Branch master set up to track remote branch master from origin.
https://github.comis listed a website (the
brew install git-lfsfor git large file storage
treeto view directory trees from the command line
watchto rerun commands forever, e.g. use
watch --interval 1 lsto rerun ls every second so you can see files get updated while some process is running.
hgfor Mercurial source code repositories
cmakefor software that uses
cmakeinstead of Make to build stuff
gifsiclefor making Gifs on the command line
imagemagickfor manipulating image types on the command line
rubyfor managing Ruby Gems such as Jekyll and Travis-CI. Plus there’s a nice
gisttool for creating gists from the command line Then …
brew install gem
brew install jekyll
brew install travis
brew install gist- nice tool for creating gists from files via the command line
I decided to keep all my github repositories in my home directory, under
Here are some other software packages that I find very useful to use on my Mac.