Craft's install documentation assumes but doesn't explain several prerequisites (like setting up my MySQL) and The Absolute Beginners Guide to Setting Up Craft on Mac (sounded perfect) was directionally helpful but had some errors and, at the end of the day, simply didn't work for me. For the longest time, I could not get Craft to connect to MySQL, even though it was installed correctly and running.
These are the perquisite steps, assuming you aren't already running Apache and MySQL:
- Step P1: Download and install MAMP -- This sets up a Macintosh, Apache, MySQL, and PHP solution stack and gives you a simple management interface to start and stop the servers.
- Step P2: Download and install Sequel Pro -- This gives you a simple tool to manage your MySQL databases.
- Step P3: Open MAMP (not MAMP Pro), and click "Start Servers" -- This starts the Apache Web server and the MySQL database engine.
- Step P4: In MAMP, click "Open WebStart page," if MAMP didn't already open one in your browser automatically.
- Step P5: Open Sequel Pro, and use the parameters on MAMP's WebStart page to create a connection -- I could not create a Standard connection using '127.0.0.1'. I had to create a Socket connection, using 'localhost'. This is the scenario that the Craft installation instructions don't anticipate.
- Step P6: Click the control in the upper lefthand of Sequel Pro, and choose "Add Database ..." to create a database, e.g.. 'crafted'. Choose UTF-8 for “Database Encoding."
These steps track those in Craft's installation instructions but with some additional explanation. Read them together:
- Step C1: Upload the files -- You're uploading the files, because you're pushing them to your Apache Web server on your Macbook.
- Download Craft -- It will end up in your Downloads folder. There are two folders craft/ and public/ in the downloaded 'Craft-2' folder.
- Copy the craft/ folder to /Applications/MAMP, i.e., above the webfoot (htdocs/).
- Copy the files htaccess, index.php, and robots.txt from public/ to the htdocs/ folder.
- Rename htaccess to .htaccess -- Open Terminal and run the following commands:
- "cd /Applications/MAMP/htdocs" -- go to where htaccess lives
- "defaults write com.apple.finder AppleShowAllFiles -bool true" -- show hidden files
- [Relaunch the Finder] -- hold down control-Alt while you click on Finder in the dock and then choose Relaunch
- "mv htaccess .htaccess" -- rename htaccess
- "defaults write com.apple.finder AppleShowAllFiles -bool false" -- hide hidden files
- [Relaunch the Finder again]
- Step C2: Set the permissions
- Open Terminal and run the following commands:
- "cd /Applications/MAMP/craft" -- go to the craft/ directory
- "chmod -R 744 app"
- "chmod -R 744 config"
- "chmod -R 744 storage"
- Step C3: Create your database
- Nothing to do here -- You already did this in Step P6 above.
- Step C4: Tell Craft how to connect to your database
- Copy the default settings in "craft/app/etc/config/defaults/db.php" into "craft/config/db.php"
- Update the parameters
- Set 'unixSocket' to the Socket value on your MAMP WebStart page (e.g., "/Applications/MAMP/tmp/mysql/mysql.sock").
- Step C5: Run the installer!
- The URL is "localhost:8888/admin"
- Follow the installation screens
I'm guessing that if you are setting up Craft in a production environment on a production Mac you might want to do somethings a little different, but this will get you a sandbox to play in. Enjoy!
First of all, I appreciate you putting this up. I've been having issues for sure.
ReplyDeleteThat being said, what do you mean by "upload the files"? For trying not to skip steps, this seems like a pretty vague step.
Sorry about that. The bulleted items underneath that heading are what I mean by "upload the files." Essentially you have to first download the Craft files to your Macbook and then copy (= upload) them to the right places on your Macbook. That's what the steps describe how to do. Good luck!
DeleteReally appreciate the help. However, when I download MAMP it is not a directory and can't it's contents cannot be accessed through terminal because it's marked as a "data" filetype. The logo is gray and I can't access it's contents through terminal. Any ideas to help out?
ReplyDeleteWhat step are you having trouble with? Sounds like maybe you're trying to do something with the MAMP app when you want to be doing something in the /Applications/MAMP directory. (The MAMP app lives in the MAMP directory.)
ReplyDeleteHi Alec, thanks for the information.
ReplyDeleteAll run fine for me except C4, the last bullet. That is not done in the terminal, right?
Set 'unixSocket' to the Socket value on your MAMP WebStart page (e.g., "/Applications/MAMP/tmp/mysql/mysql.sock").
Could you please describe further?
Thanks
Correct. It's NOT done in the terminal. In that step, you're editing the contents of the file "craft/config/db.php". You start with the default settings copied from "craft/app/etc/config/defaults/db.php" and update the parameters/environment variables. 'unixSocket' is one of those. Get the value from your MAMP WebStart page.
DeleteI'm having a hard time! MAMP is running well, and I went though all of the setup steps. I'm just getting a 500 Server Error anytime I try to access /index.php or /admin. Any ideas?
ReplyDeleteI'm not a server expert, but based on the error message you're getting and a quick search (see https://mediatemple.net/community/products/dv/204644990/why-am-i-getting-a-500-internal-server-error-message), I'm guessing you haven't got your htaccess set up right. That's step C1.
DeleteGreat, thanks!!!
ReplyDeleteThank you! That just spared me hours of time getting a test install of Craft up and running.
ReplyDeleteAwesome!
DeleteHi, thanks for this instructions. I thinks I set it up right. But when I go to the installer (Step C5), craft is saying it need 'Mcrypt'. Did this dependency change since you wrote this article or what do you think?
ReplyDeleteSorry, I don't have any idea. It's been a couple of years since I documented the process. I would search on "craft" and "mcrypt" and read those threads.
DeleteHey thanks a lot for posting this.
ReplyDeleteI'm having issues with the terminal section;
cd/Applications/MAMP/htdocs and .../craft = "No such file or directory"
Do you have any ideas?
If "cd /Applications/MAMP/htdocs" and "cd /Applications/MAMP/craft" don't work in Terminal, it feels like MAMP didn't installed and you didn't get Craft copied over there. You know there's a space between the "cd" and the "/Application ...", right?
DeleteThank you for this!!! Much appreciated!!!
ReplyDelete