16

I've started toying with some Mac development and wonder where the best place to store the code is?

Generally on my windows box, I'd store all my code in c:\Code\

On the Mac it's in /Users/Liam/Code/

Will this cause me any issue with permissions when running web code?

Bryan Oakley
  • 25,192
  • 5
  • 64
  • 89
LiamB
  • 658
  • 1
  • 7
  • 16

1 Answers1

18

Your home directory is a great place to store your code on a Mac/Ubuntu (Linux based system).
I would still create sub directories under it as appropriate. I usually organize by project, with a few extra directories for whatever, e.g.

/home/myname/project_pear  
/home/myname/project_pear/upgrade/  
/home/myname/random_java_code  
/home/myname/Dropbox/my_open_source_awesome_project  

The other thing I do which is really "big" for me is to create aliases in .bash_rc (Ubuntu) or .bash_profile (Mac). I have so many now I put them in a separate file called .bash_aliases. (which I keep on Dropbox of course...) and include it with:

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

For instance, for the above, I might create a 'mup' alias that does a cd /home/myname/project_pear/upgrade, then I can just type mup at the command line to do that long cd!

Another hint - when you copy working code into a unix based system, you will often find that executable say 'insufficent permission'. However you can frequently fix that with chmod +x filename (modify the file so that is has eXecute permission.

junky
  • 840
  • 5
  • 12
  • This is great, thanks for the tip on the Bash_Aliases. I found on a mac if I go - alias code="cd /Users/Liam/Code/" i now map Code straight to my Code directory. – LiamB Feb 26 '12 at 20:43