Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHemadri Sen
8,621 PointsHow to use Composer in Mac
This workspace is so confusing when I am trying to build a website with Sublime Text locally. I have installed composer on my mac but I am lost on how to create the composer.json file and update it using the command line.
Main problem is I can't connect the command line with the htdocs. If someone can help with that, it would be greatly appreciated.
3 Answers
thomascawthorn
22,986 PointsYou can create the composer.json file manually, or go right ahead and let composer do it for you :)
if you go to terminal and 'cd' to the directory where you want your project to be e.g.
cd ~/Projects/my-test-project/
When you're there type
composer init
You should then be prompted to fill in a whole bunch of stuff, most of which you can leave empty (composer will use sensible defaults). Once set up, you'll need to do
composer install
and you should be ready to go!
If you haven't installed composer globally, you might get an error when you type 'composer init'. If you need help installing composer locally, just let us all know. You can also work through using the composer docs
Hemadri Sen
8,621 PointsHello Tom, I created a folder on my desktop and it worked, i was able to create everything that was explained in the video but I cannot access to the default folder in MAMP directory. I tried the following command but it did not work:
cd applications/mamp/htdocs
Please let me know how can I select the htdocs file from the terminal? thanks
thomascawthorn
22,986 PointsIt sounds like you're not looking in the right place :)
Generally speaking, MAMP sits in the Applications folder that sits in the route directory.
Unless you're already in the root directory, this won't work:
cd applications/mamp/htdocs
You will probably need to add a leading '/'
cd /applications/mamp/htdocs
You can always get a mac to autocomplete a directory by hitting the tab key a few times.
Also, be aware that sometimes caps matter - is it /mamp/ or /MAMP/?