Skip to content

Instantly share code, notes, and snippets.

@alexstubbs
Created November 9, 2009 15:00
Show Gist options
  • Save alexstubbs/230009 to your computer and use it in GitHub Desktop.
Save alexstubbs/230009 to your computer and use it in GitHub Desktop.
Macports and macports update.
$ sudo mysql_install_db5 --user=mysql
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'
/opt/local/lib/mysql5/bin/mysqladmin -u root -h Alexandru-Stubbss-MacBook-Pro.local password 'new-password'
Alternatively you can run:
/opt/local/lib/mysql5/bin/mysql_secure_installation
In case of weirdness, you can start the MySQL daemon with:
cd /opt/local ; /opt/local/lib/mysql5/bin/mysqld_safe &
Navicat - native OSX & damn good mysql client, download the free lite version from
http://www.navicat.com/en/download/download.html
Textmate
# Textmate bundles
mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
svn co http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle/
Ack in project bundle installed via get-bundles, as well as spec bundle, and cucumber bundle
# Ack in project defaults
cat ~/.ackrc
--type-add=ruby=.haml,.rake,.rsel,.spec,.feature
# Textmate editing of commit messages (inserts the above lines)
# http://github.com/guides/issues-with-textmate-set-as-git-editor
git config --global core.editor "mate -w"
# Native bindings time, ImageMagick first
sudo port install ImageMagick
sudo gem install rmagick --no-ri --no-rdoc
Gem update
$sudo gem install passenger
The above line also tells you what you have to push into your apache config, eg for me,
#--- Apache - Passenger
sudo nano /etc/apache2/httpd.conf
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.2.5
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
# if serving from inside the documents folder, it needs to be readable by Apache - though not advisable. Change where you're hosting your rails projects, or, at your own peril:
chmod 775 ~/Documents/
# mysql gem is a pain, so this is the line that worked for me:
sudo gem install mysql --version=2.7 -- --with-mysql-include=/opt/local/include/mysql5 --with-mysql-lib=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config --no-ri --no-rdoc
I also setup history-search-backwards, bound to [fn]+[shift]+[up] (or +down)
cat >>~/.inputrc <<'END'
"\e[5~": history-search-backward
"\e[6~": history-search-forward
END
bind -f ~/.inputrc
# from http://ptspts.blogspot.com/2009/08/how-to-set-up-keys-pageup-pagedown-home.html
Some other bash niceties, taken from
# from http://macfidelity.de/2008/07/02/mac-customizing-terminal-in-mac-os-x-105/
sudo nano /etc/paths
# from http://www.sweeting.org/mark/blog/2008/05/26/mac-os-x-tip-setting-path-environment-variables
cat .bashrc
# mostly from http://macfidelity.de/2008/07/02/mac-customizing-terminal-in-mac-os-x-105/
# Define how Bash prompt looks like:
#
# User @ Host working dir
#export PS1="\u@\h\w$ "
export PS1="\u@\h\w: "
# Cli Colors
export CLICOLOR=1
# use yellow for dirs
export LSCOLORS=dxfxcxdxbxegedabagacad
# Alias
#
#
alias ls='ls -al'
alias rrs='RAILS_ENV=test rake spec'
alias rrf='RAILS_ENV=test rake features'
alias rrc='RAILS_ENV=test rake cruise'
alias gitd='git diff -w | mate'
alias gits='git status'
alias gitc='git commit -a'
alias gitp='git pull --rebase'
alias capsd='cap staging deploy:migrations'
alias capsdp='cap staging deploy:pending'
alias pncsl='cd ~/Documents/projects/ncsl/'
# history handling
#
# Erase duplicates
export HISTCONTROL=erasedups
# resize history size
export HISTSIZE=10000
# append to bash_history if Terminal.app quits
shopt -s histappend
# Editor
export EDITOR=/usr/bin/nano
LDAP email integration
# from http://groups.headshift.com/display/headshift/2008/04/28/How+to+set-up+LDAP+look-up+for+Address+Book+and+iPhone?focusedCommentId=30344369&#comment-30344369
PATH malarchy:
# Path Craziness - need to logout/login for the changes to take effect..
cat ~/.MacOSX/environment.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/usr/X11/bin</string>
</dict>
For the PATH malarchy:
cat ~/.MacOSX/environment.plist  results in :
http://pastie.org/private/lad0h7qnikf1vj9kmnquq
Changes to this file (as advocated by Apple) are enacted on logging out & back in to your Mac's user account.
related articles are
http://developer.apple.com/mac/library/qa/qa2001/qa1067.html
http://www.peter.com.au/macosx/index.html
http://www.mactech.com/articles/mactech/Vol.23/23.07/2307MacEnterprise-EnvironmentVariables/index.html
Some tweaks towards running cucumber features individually in texmate (if using GetBundles, you can add the Cucumber bundle to Textmate..)
and then you'll want to edit
mate ~/Library/Application\ Support/TextMate/Pristine\ Copy/Bundles/Cucumber.tmbundle/Support/lib/cucumber/mate/runner.rb
so that line 28 reads
puts `./script/cucumber #{argv.join(' ')}` #puts `./script/cucumber.rake #{argv.join(' ')}`
And that should be all you'd need to be able to run cmd+R for individual feature files
Telling textmate where to find git - from http://solutions.treypiepmeier.com/2008/02/25/installing-git-on-os-x-leopard/
sudo ln -s /opt/local/bin/git /usr/bin/git
Other Gems: capistrano and capistrano-ext (for deployment via multistage)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment