CakePHP, Set "cake" Environment Variable?
I'm using the "cake" console in cakephp on Mac OS X 10.6.2. How do I set up the environment variable (or PATH?) so that all I need to type in terminal is "cake"... as opposed to the full path to the conso开发者_如何转开发le app?
I'm unabashedly a newb when it comes to terminal commands and these UNIX things (but I'm learning!), so bear with me if my explanation/vocabulary is a bit off.
You should add
alias cake=PATH_TO_CAKE
To your .bashrc file (it's usually in your home directory).
To expose all cake scripts in the shell directory, add the cake shell path to your system path.
export PATH=/your_path_to_cake:$PATH
Both alias and export can be added to your .bashrc file or executed directly on the command line. .bashrc is a shell script which will be executed each time you start a new shell session and placing one or both of the lines will make cake point to the correct program reagardless of your working directory.
The above solution posted by matiasf should get you going pretty quickly.
The only thing I'd recommend is putting your cake directory in a central location (ie, /usr/local/cake).
I recently wrote up some instructions in a blog post (http://developinginthedark.com/posts/cakephp-tip-2-run-multiple-cakephp-releases) that walks through settings things up on a Mac (and user commented instructions for Windows), specifically focusing on getting an environment up and running that supports multiple releases of CakePHP.
It sounds like you just need to get going with one version, but the instructions should still be relevant.
Hopefully this helps yourself and/or others.
精彩评论