So I recently got my first ever new MacBook Air! Yay! But I had to go through setting up everything again... Well, much like previous posts about setting up dev environments, I also experienced a bit of hell figuring out every little thing. As much as I wanted to blame the computer though, I knew it was just me because I forgot a lot about how to do it. So here I am writing this for my future self, in case I ever have to do it again, and also for anyone else who might have to do it.
The Basics
Being a TA at Actualize helped me remember a bit about setting up my environment. There was an awesome guide I could follow, and I initially wanted to just get the basics. In this case, the basics meant anything that I needed to work:
- Chrome
- Slack
- Atom
- Homebrew
- Correct Ruby version
- Rails
- PostgreSQL
- Git setup
- Terminal settings
- Atom packages (Linter, Emmet, ERB-snippets for Rails, etc)
Chrome, Slack and Atom were pretty straightforward, and the Go Rails guide made installing the others pretty easy. I went through similar hell as Jess did in the above post with rbenv
, and thankfully fixed it after a good amount of Googling. Great! Everything's done... right?
Lo and behold, I had a few missing quality-of-life settings. I didn't have Terminal or Git auto-complete. Good thing my brain reminded me to just copy my old dot files (.bash_profile, .inputrc, for example) from my old machine and we should be good.
And done! I think. There's still that nagging feeling that I'm missing something, but it'll probably be there until I get comfortable typing on this computer.
Here's my .bash_profile
for anyone interested:
# Show what Git branch you're on in command line
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\033[36m\]\w\$(parse_git_branch)\[\033[0m\] $ "
# git auto complete commands and branch names
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# fix rbenv shell command
eval "$(rbenv init -)"
And my .inputrc
for auto-complete with bash:
set completion-ignore-case on
TAB:menu-complete
Never ending list of additions:
- Emmet and Atom sometimes don't play nice with their auto-complete. To fix, go to settings bar: Atom -> Keymap... and paste the following:
'atom-text-editor[data-grammar="text html ruby"]:not([mini])': 'tab': 'emmet:expand-abbreviation-with-tab'
Restart and tabbing with .html.erb files should work. (For those not using Ruby, you can just delete[data-grammar="text html ruby"]
.)
Top comments (10)
Hello, use Oh My Zsh!
ohmyz.sh
Thanks! Maybe one day...
Emmet for Atom looks cool. big fan of Atom. I use TextExpander my self to expand snippets etc. Its probably a caveman solution compared to Emmet tho βοΈ
Emmet is great. Makes writing HTML 100x easier. Also, I would look into the Atom wrap-in-tag package. So so so useful for adding in HTML tags.
Now what if I need to install Ruby on Windows?
That's a road that I'm avoiding doing... I've heard Ruby Installer is decent though:
rubyinstaller.org/
I solved a few of them with docker,few with gists and few with the IT guys π€£
For Windows I learned about boxstarter.com, should be something for Mac too.
I still need git-autocomplete.
The list never ends.
Finally added git-autocomplete π