Mother Effing Dotfiles

So… dotfiles…

These have been on my TODO list for a while, searching Google I couldn't really find any decent screencasts or thorough documentation for a n00b like me. I'd seen this page over at GitHub https://dotfiles.github.com/ and started by looking over some examples:

gf3, mathiasbynens, necolas, paulirish, holman, skwp.

Which lead me to look at a few other links: technicalpickles/homesick, robbyrussell/oh-my-zsh, robbyrussell/oh-my-zsh/wiki/Themes, oh-my-git-aliases, Bash Tutorial.

Before getting stuck in I had a few concerns, luckily awesome people like Mathias Bynens and Paul Irish helped me out.

@simonowendesign: If I add dotfiles, then delete them, will my settings go back to what they were before adding? @mathias: In general, yes. Exceptions: files like .osx, who change system settings when sourced. @simonowendesign: Thanks, have you ever broke anything with .osx, if so, how did you revert / fix it? @mathias: defaults delete

@simonowendesign: If I was to start up an osx dotfile now (having previously not used one, but manually changing settings), will this set all my settings to default, then add the ones in my dotfiles, or will it only activate / deactivate the ones listed in the dotfile? @paul_irish: Just the ones listed, you only execute it once, and it just changes the ones in there, the osx one is a bit diff than most of the dotfiles, cuz they execute, set configuration, all the time.

@simonowendesign: Was wondering if there's any particular dotfile you'd recommend starting with? @paul_irish: bash_prompt! always.

Where To Start?

First off I backed up all my existing dotfiles, these are located in your user folder e.g. /Users/simonowen. You'll need to be able to view hidden files, I use TotalFinder which has a handy shortcut for this, but there are commands you can run in the terminal as well to see these (this is actually included in the dotfiles).

Knife, Fork, Spoon?

I chose to take a fork from Paul Irish's dotfiles, I've watched screencasts that he's done and knew there was lots of awesomeness going on that I wanted to get to grips with. After that I cloned the repo to my computer and started digging around. I changed references from Paul Irish to myself, then I read through all the files, yup, all of them and others too (I'd strongly recommend this, rather than rushing into it). Then I went over them again and commented out parts I was unsure about or I knew wouldn't apply to my setup and added some TODOs of things I wanted to update [! Note to self, add these as issues !].

Committed and pushed, now I'm already to go :D

Pre-Flight Checks

I knew that I'd already installed some things like homebrew, z etc.. So rather than running the full install-deps.sh file I opened it instead and added the bits I was missing and double checked the others.

If you'd like to run the file you can do this by doing (changing path/to/file to where the file is):

1
sudo bash path/to/file

Going The .extra Mile

Next up the .extra file and where my n00bness kicks in…

After backing up all my existing dotfiles, I guessed the new ones would need to go where they were, so I created the .extra file there as per Paul's with the following code:

1
2
3
4
5
6
7
8
9
# PATH like a bawss
PATH=/opt/local/bin
PATH=$PATH:/opt/local/sbin
PATH=$PATH:/bin
PATH=$PATH:~/.rvm/bin
PATH=$PATH:~/code/git-friendly
# ...

export PATH

Don't seem to have an opt folder, not exactly sure what that's for, but carried on.

Pretty Colours

Syntax highlighting = Yes, please.

OS Se.X.y

Sensible OS X defaults = Going to leave this one till last, after reading over it the first time I had a grin the size of a Cheshire Cat.

Take Off!!!

Opened up a new terminal, made sure I was in my user home directory:

1
cd ~

Then ran the sync.sh:

1
git clone https://github.com/simonowendesign/dotfiles.git && cd dotfiles && ./sync.sh

But.. oh no :( Got the following errors:

1
2
3
4
5
6
7
8
/Users/simonowen/.bash_prompt: line 66: dirname: command not found
/Users/simonowen/.bash_prompt: line 66: basename: command not found
/Users/simonowen/code/z/z.sh: line 204: grep: command not found
/Users/simonowen/.rvm/scripts/functions/support: line 13: grep: command not found
/Users/simonowen/.rvm/scripts/rvm: line 132: grep: command not found
/Users/simonowen/.rvm/scripts/rvm: line 133: grep: command not found
/Users/simonowen/.rvm/scripts/functions/rvmrc: line 454: dirname: command not found
simon-owens-MacBook-Pro:dotfiles simonowen$

Tried running grep, command not found, then came up a directory to see what happen and it worked:

1
2
3
4
5
6
7
8
simon-owens-MacBook-Pro:dotfiles simonowen$ simon-owens-MacBook-Pro:dotfiles simonowen$ grep
-bash: simon-owens-MacBook-Pro:dotfiles: command not found
simon-owens-MacBook-Pro:dotfiles simonowen$ cd ..
simon-owens-MacBook-Pro:~ simonowen$ grep
usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]

Tried running the sync.sh again:

1
sudo bash dotfiles/sync.sh

But got the same errors…

So why is it not working?

Thinking possibly something to do with the .extra file and PATHS, Mathias also had an .extra file:

1
2
3
4
5
6
7
8
9
10
11
# PATH additions
export PATH="~/bin:$PATH"

# Git credentials
# Not in the repository, to prevent people from accidentally committing under my name
GIT_AUTHOR_NAME="Mathias Bynens"
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
git config --global user.name "$GIT_AUTHOR_NAME"
GIT_AUTHOR_EMAIL="[email protected]"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
git config --global user.email "$GIT_AUTHOR_EMAIL"

After updating his details to mine, tried again, then got:

1
2
3
4
5
6
7
8
simon-owens-MacBook-Pro:~ simonowen$ sudo bash dotfiles/sync.sh
Password:
Already up-to-date.
This may overwrite existing files in your home directory. Are you sure? (y/n) y
building file list ... done

sent 3143 bytes received 20 bytes 6326.00 bytes/sec
total size is 797872 speedup is 252.25

No errors… hmmm… did it work?

Tried doing .. which should now be the equivelant of cd ..:

1
2
simon-owens-MacBook-Pro:~ simonowen$ ..
-bash: ..: command not found

Nope :( Would be nice if someone could let me know what was going on here :)

Let's try switching it off and on again!

Restarted, opened up terminal and… what's this??

1
~

Hmmm… ok, that's different, let's try some stuff:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$ pwd
/Users/simonowen
~
$ ..
/Users
$ z 24
24pullrequests/ 24pullrequests/
/Users
$ z 24
/Applications/MAMP/htdocs/24pullrequests on master
$ ls
Gemfile Rakefile config.ru lib server.rb
Gemfile.lock Readme.md db log spec
Guardfile app design public tmp
Procfile config doc script vendor
/Applications/MAMP/htdocs/24pullrequests on master
$ g st
git: 'st' is not a git command. See 'git --help'.

Did you mean one of these?
status
reset
stage
stash
svn
/Applications/MAMP/htdocs/24pullrequests on master
$ git st
git: 'st' is not a git command. See 'git --help'.

Did you mean one of these?
status
reset
stage
stash
svn
/Applications/MAMP/htdocs/24pullrequests on master
$ pull
Fetching from origin ...
From github.com:simonowendesign/24pullrequests
* branch master -> FETCH_HEAD
Current branch master is up to date.
* No stashed changes, not popping
* Bundling gems...
Done
/Applications/MAMP/htdocs/24pullrequests on master
$ slt

Yes, yes, yes, boom, boom… BOOM!

Woooohooo!!! Looking good :D

So what I just did was:

pwd to show me the present working directory.

Instead of doing cd .., I'm now able to just do ...

Then used z to find a Git directory and go directly to it.

Then g instead of git, but I need to add in some previous aliases I'd set to change st to status. Lucky I backed up all my dotfiles ;)

Then was able to do pull.

Finally slt took me into Sublime Text 2…

Mother Effing Awesome

And there you go! https://github.com/simonowendesign/dotfiles

Next… .osx

Browse by category: