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

Ruby

Installing the Treehouse VM on Mac

How do I modify my current projects Vagrantfile to use another port?

Here's the Terminal message when I try to download and reinstall the virtualbox:

Vinhs-MacBook-Pro:treehouse vvu$ cd treehouse
-bash: cd: treehouse: No such file or directory
Vinhs-MacBook-Pro:treehouse vvu$ ls
Vagrantfile projects
Vinhs-MacBook-Pro:treehouse vvu$ vagrant up

Bringing machine 'default' up with 'virtualbox' provider... Vagrant cannot forward the specified ports on this VM, since they would collide with some other application that is already listening on these ports. The forwarded port to 3000 is already in use on the host machine.

To fix this, modify your current projects Vagrantfile to use another port. Example, where '1234' would be replaced by a unique host port:

config.vm.network :forwarded_port, guest: 3000, host: 1234

Sometimes, Vagrant will attempt to auto-correct this for you. In this case, Vagrant was unable to. This is usually because the guest machine is in a state which doesn't allow modifying port forwarding. Vinhs-MacBook-Pro:treehouse vvu$

1 Answer

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Try changing it in the Vagrantfile:

config.vm.network :forwarded_port, guest: 3000, host: 3001

That should set it so you access it from your local computer on port 3001 instead.