Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Lion dev environment notes

First things first...

Fire up your database

  • Edit /etc/paths to put /usr/local/bin on top, so that lion's psql doesnt win

Install postgres and init the db

brew install postgres
initdb /usr/local/var/postgres

Add aliases to your shell for spinning postgres up/down (and while we're at it, put brew's python packages on the path so we can run mapnik later and tell zsh not to autocorrect a couple things)

alias postgresup='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
alias postgresdown='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
alias mvim='nocorrect mvim'
alias rbenv='nocorrect rbenv'

Okay, now install the GIS fun after postgres is happy

brew install gdal --with-postgres
brew install postgis

(creating geo databases got easier, no need to install the templates, see http://postgis.refractions.net/documentation/manual-2.0/postgis_installation.html#create_new_db_extensions)

Higher-level GIS tools

Tap the homebrew/science repo and build QGIS

brew install libspatialite
brew tap homebrew/science
brew install qgis --with-grass --with-postgis

Follow the instructions to make it a pretty bundle...

Build mapnik

brew install mapnik

And of course, you must have virtualenv

Get pip, if you haven't already, then vitrualenv. And then virtualenvwrapper (http://virtualenvwrapper.readthedocs.org/) cuz its awesome. (Adding the setup to the end of my .zshrc, use .bash_profile or whatever if you like.)

sudo easy_install pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper
echo 'source /usr/local/bin/virtualenvwrapper.sh' >> ~/.zshrc

Doing ruby?

Get rbenv (https://github.com/sstephenson/rbenv).

Note, I'm modifying my .zshrc cuz I do zsh. You'd do your .bash_profile if you're normal.

brew install rbenv
brew install ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc

You'll want to open a new shell to get that stuff we just put on your path. Here's how you see what fancy new ruby versions you can install, and how to get one w/ rbenv:

rbenv install
rbenv install 1.9.3-p194

Other tools I love

@jpvelez

This comment has been minimized.

Copy link

commented Jul 14, 2012

Vim is pretty rad once you get used to it. I've been building a cheat sheet, lemme know if you want it.

You'll wanna add these things to your ~./vimrc file, trust me.

" big E goes to end of line, big B goes to beginning
map E $
map B 0

" jk as a shorcut for Escape in Insert and Command modes
noremap! jk
noremap! kj

" ... in Visual and Select modes
vnoremap jk
vnoremap kj

This way you can mash j and k keys to get out of insert mode, and it's much easier to go to beginning and end of line. Also apparently you can intergrate vim an ipython so you get ipython-esque autocompletion, though I haven't futzed with that yet.

I like to use vim inside iterm because you can split screen cli and vim. You can enable most of the macvim mouse functionality for vim by adding this to .vimrc
set mouse=a

@tonyatoms

This comment has been minimized.

Copy link

commented Feb 12, 2013

re: "Edit /etc/paths to put /usr/local/bin on top, so that lion's psql doesnt win"

Which end of one's path is the top? I should know this, but I don't. I'm just guessing I'm not the only one...

EDIT: oh! I didn't know how OS X did the path thing. /etc/paths is a text file that is literally a list of paths, so the top is well, the top of the file!

@tothebeat

This comment has been minimized.

Copy link

commented Mar 21, 2014

I mapped F2 to remove trailing whitespace for every line. With PEP8 checking, extra whitespace leads to glaring red blocks, and instead of turning off that warning I abide by the rules.

" Remove trailing whitespace from every line
nnoremap <silent> <F2> :%s/\s\+$//e<CR>

Since I'm often frantically mashing Escape or F2, I remapped F1 to do nothing (who needs a dedicated key to bring up embedded help?).

" damn you, F1! I'm just flailing to hit Escape, I don't want help!
nnoremap <F1> <nop>

Also, if you're masochistic, you can force yourself to use the standard dired movement in vim using HJKL by remapping the arrow keys to do nothing.

" Remap the arrow keys to nothing to force me to use hjkl for movement
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>

This auto-reloads vimrc on changes to the file:

" auto-reload vimrc on changes: http://stackoverflow.com/a/2400289
augroup myvimrchooks
    au!
    autocmd bufwritepost .vimrc source ~/.vimrc
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.