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 trial

Juliette Tworsey
Front End Web Development Techdegree Graduate 32,592 PointsInstalling Composer Locally on Mac OSX 10
Hi,
I have completed the course in Workspaces and even though I apparently have the correct code (according to other students) I have been unable to load the site when attempting to preview it.
I have started a new site folder in htdocs on my locally installed MAMP server. How do I install Composer locally?
I am going to attempt to start over from scratch.
Thanks!
8 Answers

Juliette Tworsey
Front End Web Development Techdegree Graduate 32,592 PointsI have just installed (finally...lol) composer to my local directory in htdocs by typing this into the console:
cd /applications/mamp/htdocs/composerphpslim (my project/folder name)
...then this:
curl -sS https://getcomposer.org/installer | php
The console returned this:
Composer successfully installed to: /Applications/MAMP/htdocs/composerphpslim/composer.phar Use it: php composer.phar
So far so good I think....

Ted Sumner
Courses Plus Student 17,967 PointsOnce you have composer installed globally, then you can run composer init. I know this is covered in the course. Answer the required questions (some are not required) and it will initialize the project. This video goes step by step through the init process and has you install monolog.

Hemadri Sen
8,621 PointsHello Ted, Thanks for your reply. I did install composer globally and I tried to run composer init, it worked fine but composer.json file was not installed in my specific project folder, this is where I am getting stucked.
I am trying to install the composer in my htdocs folder to run it with the MAMP. Please advise how should I define the folder in the terminal so that it knows where to install the composer file.
thanks,

Ted Sumner
Courses Plus Student 17,967 PointsFirst, I recommend that you install your projects in subfolders in the htdocs folder. That way you can work on multiple projects at the same time.
Open your command line tool and enter change directory to the folder with the project. The command would look something like this: cd /opt/lampp/htdocs/project_folder
Then run composer init
Answer the questions and it should create the Json file in the root of the project.

Ted Sumner
Courses Plus Student 17,967 PointsThe path is what is on my Linux machine for the XAMPP install. You need to use your own path. I don't know what that is.

Romuald Le Bris
3,975 PointsHere is the best installation guide I found on Github ! Worked perfect for me !

Ted Sumner
Courses Plus Student 17,967 Points
Juliette Tworsey
Front End Web Development Techdegree Graduate 32,592 Points@ 3:47 Hampton points out that Composer is already installed on Workspaces. He does not explain how to install it locally.

Ted Sumner
Courses Plus Student 17,967 Points
Juliette Tworsey
Front End Web Development Techdegree Graduate 32,592 PointsThanks Ted, but I don't even know where to start to run the code (in my project directory or directly in my terminal) or what the difference between running it locally or running it globally means.
Are there any tutorials on Treehouse for this that you know of?
Thanks again:-)

Ted Sumner
Courses Plus Student 17,967 PointsI think I did a global installation. Just copy and paste the command given in the link to your terminal and let it run. I am using Linux Mint and it may have been in my package manager. I don't remember now what I did.

Hemadri Sen
8,621 PointsI found a way to install it on the Mac, you just have to copy paste the things for global installation. But the place where i really got stuck is how to use it Locally. I couldn't find a way to link the terminal with the folder.

Juliette Tworsey
Front End Web Development Techdegree Graduate 32,592 PointsI have just installed it locally to my project folder. See my comment below and see if it works for you:-)