Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mcsolas

macrumors regular
Original poster
Jan 4, 2013
134
1
I have been working with sites for many years on windows, just now switching to the Mac OSX platform.

Right now I am looking at setting up my local development environment. I looked through a few threads and I am downloading MAMP now. It seems the Mac comes with PHP installed, but it sounded like this keeps it all in a container and deployment was easy.

Are there any tricks to getting that up an running? How do you handle developing multiple sites at once, or do you just copy them into a folder and work on them one at a time?

What other tools might be of interest? I usually work with WordPress / LAMP based hosts these days.
 

NikMac

macrumors member
Feb 9, 2008
63
0
Canada
Personally I use Komodo Edit (free version) for web development projects - I have a separate folder for each project and Komodo is able to open the entire website with a convenient ".kpf" project file. You can also open documents from different projects simultaneously but I prefer to focus on one project at a time.

I use the Firebug extension for Firefox for fine-tuning CSS, and you've already found MAMP for working with PHP. WordPress and Smashing Magazine have good guides for using it:
http://codex.wordpress.org/Installing_WordPress_Locally_on_Your_Mac_With_MAMP
http://wp.smashingmagazine.com/2011/09/28/developing-wordpress-locally-with-mamp/
 

mcsolas

macrumors regular
Original poster
Jan 4, 2013
134
1
Thanks for those links, I am checking them now.
Personally I use Komodo Edit (free version) for web development projects - I have a separate folder for each project and Komodo is able to open the entire website with a convenient ".kpf" project file. You can also open documents from different projects simultaneously but I prefer to focus on one project at a time.
I am definitely going to check this out. I prefer to go one at a time as well, but sometimes things come up and you just need to do a few things quick. I can see where it could come in handy.
 

Dunmail

macrumors regular
Mar 27, 2009
224
4
Skipton, UK
I use the built in Apache and PHP versions. Downloaded Mysql and set it up. If you can set up virtual servers in Apache then you aren't limited to putting everything under "Sites".

I've not used MAMP so can't comment on how much less effort it might be.

Beyond all that I downloaded and installed Git for source control. I use Sublime Text 2 with the Git plugin. For each project it's a case of doing the following in a terminal window:

cd project folder
git init
git add *.php

From then on it's just a matter of doing a quick commit at regular intervals.

Sublime text can handle multiple projects and swapping between them is just a couple of key strokes.
 

DelisleBA.info

macrumors member
Apr 12, 2011
38
0
Athens, OH
Here is a video I made that might help


It covers Setup of Apache, PHP, MySQL and WordPress on OS X Mountain Lion.
 
Last edited by a moderator:

grizfan

macrumors member
Feb 10, 2012
86
4
Boise, ID
I also recently completed the switch to the Mac for web development. I've been dabbling at home for about a year and finally replaced my work PC with an iMac.

I set up my own AMP stack using these two guides:
http://coolestguyplanettech.com/dow...ysql-php-and-phpmyadmin-osx-108-mountain-lion
http://coolestguyplanettech.com/downtown/how-set-virtual-hosts-apache-osx-108-mountain-lion

works great, and was a good opportunity to learn more about *nix commands from terminal. For each of my projects, I have a separate dev folder under my sites directory, each with its own virtual hosts entry and entry in the hosts file. Each of my projects can then be accessed with its own URL, such as project1.local, project2.local, etc...

I use Filezilla for FTP, a combination of command line and Cornerstone for SVN (hosted on Beanstalk), Pixelmator for my limited image editing needs.

You should also look at Codekit if you do any front-end work.

Finally, I use BBEdit for my editor, but this is a pretty personal choice from some great options on the Mac. I recommend checking out BBEdit, Coda and a few others, take advantage of the 30 day trial to find one that best fits your needs.
 

mcsolas

macrumors regular
Original poster
Jan 4, 2013
134
1
You should also look at Codekit if you do any front-end work.

Finally, I use BBEdit for my editor, but this is a pretty personal choice from some great options on the Mac. I recommend checking out BBEdit, Coda and a few others, take advantage of the 30 day trial to find one that best fits your needs.
I just figured out how to run my preferred ftp app Beyond Compare using VirtualBox. Thanks for the editor suggestions I am going through them all. I have dw cs6 available which is an editor I am more or less familiar with ( more so cs3 ) but whatever, I am hoping to continue there but always like to keep an eye out for options, especially as I am looking to expand beyond WordPress and get more into App development.
 

grizfan

macrumors member
Feb 10, 2012
86
4
Boise, ID
I just figured out how to run my preferred ftp app Beyond Compare using VirtualBox. Thanks for the editor suggestions I am going through them all. I have dw cs6 available which is an editor I am more or less familiar with ( more so cs3 ) but whatever, I am hoping to continue there but always like to keep an eye out for options, especially as I am looking to expand beyond WordPress and get more into App development.

I was using DW CS5.5 for the longest time, but found it VERY limiting. BBEdit has proven to be a far more capable editor, especially when wrangling large projects. A couple of co-workers swear by Coda. I think either would be a better option than DW, once you got used to the change.
 

Dunmail

macrumors regular
Mar 27, 2009
224
4
Skipton, UK
Coding editors are a very personal thing - some you get on with, others you don't and it doesn't matter how many people recommend them they aren't for you. I've never *got* emacs for example.

If you find yourself fighting the editor then it's time to move on. On a more positive note if you find yourself firing up the program for any text based activity then it's likely to be the one for you. At least these days you get trial periods so you don't have to fork out loads of cash only to find the program doesn't suit you.
 

design-is

macrumors 65816
Oct 17, 2007
1,219
1
London / U.K.
I give my vote to Coda - I find it very enjoyable to work with. Built in Transmit FTP capabilities is a bonus too, though I do find having Transmit separately for some uses is more convenient.
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
Komodo / MAMP-PRO / Chrome / GIT or SVN depending on the client

Komodo - as noted earlier, excellent for project integration, but also very stable, great for sharing code and integrated version control support. This is a common IDE out there and easy to use.

MAMP-PRO - The pro version isn't free, but allows super easy GUI setup of a fully functioning LAMP stack to create a sandbox that does not interfere with the Mac's existing PHP/Apache. Adding a site is as simple as sitename.localhost, docroot path, maybe an alias or two, stop/start MAMP Pro (it will ask you), done. It also has easy GUI based support for adding SSL, email relay and customization of the PHP or MySQL environment per host, if desired. The Pro version is the way to go for professional developers or if you want to work on multi-sites. Get regular version if you're just working on your own site or need a sandbox for one site or school or learning. Pro for anything serious, spend the money.

If you want to be a pro, learn how repositories and version control works, most notably GIT and SVN. Most people don't even know that Mac OS X supports git and SVN for client use right in the Terminal window, i.e. command line, beyond a GUI client integrated into code such as Komodo or others mentioned here. I suggest you learn how to keep a Terminal window open useful for changing permissions on web folders and using version control that way at first. Learn how to import repos, run diff's and commit changes. Use GITHUB.com to create and manage your own repo, it's very easy and free for one repo for personal use.

Chrome is very stable and less bloated then FireFox in terms of web developer extensions and has a great inspection mode for debugging by developers built in. I found it runs faster on my setup and the extensions just as easy to setup and install. To each their own, of course, the point is make sure you learn how to right click on web pages to inspect the CSS and use the Javascript console most notably.

Once you got a good platform going on your Mac, you'll enjoy more time learning how to create web pages than fidgeting with installation of widgets and dealing with latency and crashes like the, um, competition.

:cool:
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
I give my vote to Coda - I find it very enjoyable to work with. Built in Transmit FTP capabilities is a bonus too, though I do find having Transmit separately for some uses is more convenient.

Great advice, please allow me to expand on your last sentence.

FileZilla for Mac is what I use as an all purpose FTP client - it's extremely fast, supports SFTP which is much more common and a easy to use GUI.

For the pro's:

It should be noted on the professional side FTP isn't used all the time due to security concerns so learning ssh and using rsync and scp and other Unix commands (all supported on Mac) to move files via command line (Mac Terminal). Most clients will ask you to generate a public key for ssh access as outlined in this web page: http://kb.siteground.com/how_to_generate_an_ssh_key_pair_in_mac_os/ then you can login to their secure servers and move content between your local sandbox and theirs, etc.
 

mcsolas

macrumors regular
Original poster
Jan 4, 2013
134
1
Komodo / MAMP-PRO / Chrome / GIT or SVN depending on the client
...
MAMP-PRO - The pro version isn't free, but allows super easy GUI setup of a fully functioning LAMP stack to create a sandbox that does not interfere with the Mac's existing PHP/Apache. Adding a site is as simple as sitename.localhost, docroot path, maybe an alias or two, stop/start MAMP Pro (it will ask you), done. It also has easy GUI based support for adding SSL, email relay and customization of the PHP or MySQL environment per host, if desired. The Pro version is the way to go for professional developers or if you want to work on multi-sites. Get regular version if you're just working on your own site or need a sandbox for one site or school or learning. Pro for anything serious, spend the money.
..
Chrome is very stable and less bloated then FireFox in terms of web developer extensions and has a great inspection mode for debugging by developers built in. I found it runs faster on my setup and the extensions just as easy to setup and install. To each their own, of course, the point is make sure you learn how to right click on web pages to inspect the CSS and use the Javascript console most notably.

Once you got a good platform going on your Mac, you'll enjoy more time learning how to create web pages than fidgeting with installation of widgets and dealing with latency and crashes like the, um, competition.

:cool:
Thanks for explaining MAMP Pro to me. Sounds like I will end up getting that from what I understand. I have the trial installed I am going to dig in and learn it a little more. I was trying to just use the free version but see a real use for the setup you are describing. One q. the databases. how do you handle that, they are all run off a single local host mysql server.. or how does that work when you switch to different sites?

I am over all, enjoying the switch. its been a somewhat crazy few weeks learning what would and woudn't work... but now that I figured out VirtualBox I feel much better since if I need to open up windows and do a few things, I just make it full screen like its own desktop and go about it.. its awesome. I am really liking how far things have come in a short time.

edit. re: chrome. I had noticed firefox was feeling too great on the osx platform. I may end up taking your advice here as well :)
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
One q. the databases. how do you handle that, they are all run off a single local host mysql server.. or how does that work when you switch to different sites?

RE: MySQL - Only run in instance of MySQL but for each site you create a database each with their own tables, traditionally. Multiple DB's per site can result in latency due to maintaining multiple connection states, so only if necessary do that.

FYI: MAMP comes with phpMyAdmin which is a free web based DB management utility making it very easy to directly browse DB content, manage structure, run/build queries or edit in place, import/export, create databases and set permissions, etc. Great way to learn before you consider $ or time invested in a commercial desktop GUI to do the same, my .02.
 
Last edited:

mcsolas

macrumors regular
Original poster
Jan 4, 2013
134
1
I am a fan of phpmyadmin & have been able to do a lot of work through it, its a great tool. The gui tools that are the most useful have synching tools that help reconcile different data sets. Any recommendations?
 

rufhausen

macrumors regular
Jul 5, 2007
135
0
Littleton, CO
I just started using MAMP Pro after using the free version for years. The main difference for me is being able to set up name-based(or IP/port-based) virtualhosts quickly without having to manually edit the apache config file directly. For name-based vhosts, MAMP Pro edits your /etc/hosts file for you so something like "appname.dev" resolves to localhost.
MAMP Pro also lets you use the default Apache/MySQL ports without having to enter your user credentials every time you restart the services.

For MySQL admin, check out Sequel Pro (http://www.sequelpro.com/).
For coding, I just moved from Coda to Sublime Text 2 and won't be going back.
 

mcsolas

macrumors regular
Original poster
Jan 4, 2013
134
1
I just started using MAMP Pro after using the free version for years. The main difference for me is being able to set up name-based(or IP/port-based) virtualhosts quickly without having to manually edit the apache config file directly. For name-based vhosts, MAMP Pro edits your /etc/hosts file for you so something like "appname.dev" resolves to localhost.
MAMP Pro also lets you use the default Apache/MySQL ports without having to enter your user credentials every time you restart the services.
From there, you can pull up multiple sites pretty efficiently and also I imagine this helps with deployment if localhost's "appname.dev" matches the site you are deploying to, I see how this could be beneficial.
For MySQL admin, check out Sequel Pro (http://www.sequelpro.com/).
For coding, I just moved from Coda to Sublime Text 2 and won't be going back.
Thanks for this link, this looks like a very nice app. I am going to be installing this today.

Can any of these editors do code highlighting for htaccess / other apache config files?
 

rufhausen

macrumors regular
Jul 5, 2007
135
0
Littleton, CO
From there, you can pull up multiple sites pretty efficiently and also I imagine this helps with deployment if localhost's "appname.dev" matches the site you are deploying to, I see how this could be beneficial.

my local vhost names usually don't match the prod domain names, but the frameworks I use have easily configureable environment detection so that it doesn't matter anyway.

I haven't used anything for Apache conf files, but it looks like there's this for Sublime: https://github.com/colinta/ApacheConf.tmLanguage
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
Apache easily allows for server aliasing in name based VHOST setup so you can have the best of both worlds, a primary host name and aliase host names if you wish, example:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName http://www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain
</VirtualHost>

If your client sees your local sandbox then use the primary set to their client name or similar to their domain name, otherwise access the same site by using something like "client-is-an-ass" when it's just you!

:p

In all seriousness, I personally prefer using the client's domain name as the server name appended with ".localhost" so when many windows are open with local, staging and prod sites for the same domain - less mistakes happen when you see "mydomain.localhost:8888", "staging.mydomain.com" and "mydomain.com" respectfully. But to each their own, of course.

Just wanted to add MAMP Pro allows custom aliasing - as simple as typing in as many as you want into the setup via the GUI interface, no editing of vhost files or local host files on your Mac.
 

mcsolas

macrumors regular
Original poster
Jan 4, 2013
134
1
I haven't used anything for Apache conf files, but it looks like there's this for Sublime: https://github.com/colinta/ApacheConf.tmLanguage
Thank you for posting this, looks promising. I dont edit many of them but when I do it would be nice to know the syntax is correct before uploading and testing on the server. :)
In all seriousness, I personally prefer using the client's domain name as the server name appended with ".localhost" so when many windows are open with local, staging and prod sites for the same domain - less mistakes happen when you see "mydomain.localhost:8888", "staging.mydomain.com" and "mydomain.com" respectfully. But to each their own, of course.

Just wanted to add MAMP Pro allows custom aliasing - as simple as typing in as many as you want into the setup via the GUI interface, no editing of vhost files or local host files on your Mac.
I think I like this idea of the prefix with domain name. I will try and set that up, however I ran into a little detail yesterday. I logged into phpmyadmin and set the root password which I quickly found was a mistake since it everything stopped working in mamp's localhost admin. I uninstalled and reinstalled it but it didnt seem to help. So today I am going to be hunting down how to admin mysql and how to remove that password I just set.
 

BryanSchmiedele

macrumors member
Apr 25, 2010
43
0
Overland Park, KS
Help with Virtual Domains

I am following this thread and trying to set up Virtual Domains on my MBP.

I have downloaded and installed MAMP Pro. Got all the basic settings correct I believe.

What I don't understand it what to put in the Hosts part of MAMP Pro and what to enter into the web browser, and how it all works.

What I want to accomplish is to be able to develop several web sites locally at the same time and preview them in Safari locally. I am using Coda 2 as my IDE.

Let's imagine I have domains

dog
cat
pig

First, the where does the localhost point to?

I believe I set up the other domains as

Server = dog.localhost
Disk Location = /Users/bryan/Sites/dog

and in the browser bar I enter

localhost:dog

Is this correct?
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
If you wish to follow the procedure I use as noted earlier this is MY way of doing it, i.e. it works for me, it can be done a million other ways, but follow and you'll see some advantages here:

First create a directory called "sandbox" off the root, i.e. /sandbox on your hard disk. This will contain all sandbox sites, each time you add one for clients create a sub-directory within, i.e. /sandbox/client1

Inside each client directory add "docroot" so you have, for example:

/sandbox/client1/docroot
/sandbox/client2/docroot

Always create the physical directories first, before going into MAMP PRO.

The load up MAMP Pro (minimum settings suggested):

Server tab -> General -> select MAMP PORTS (Apache=8888, MySQL=8889, SSL=8890) Use these ports to avoid issues with ports is use by your Mac already, also these particular ports are traditionally open in firewalls which is why I don't use 81 as some folks do for Apache, for example.

Hosts tab -> General -> + key bottom left panel to add a site

Server Name = client1.localhost
Disk location = /sandbox/client1/docroot

Add an alias using the + key bottom right panel (as many as you wish, I prefer just one, simple):
client1

The reasons you set aliases are 1) to make a friendly URL when displaying site to a client and 2) if a multisite setup, i.e. multiple domains sharing same docroot and source but different databases and files upload path, etc. Aliases are also good to test sites to ensure they are not domain name dependent, i.e. some developers check domain or host name in source - great until the client changes domain name and the source is no longer valid. Especially useful when editing someone else's site.

Apply, allow MAMP Pro to restart Apache/MySQL

Visit the site vie either of these two URL's:

http://client1.localhost:8888
http://client1:8888

Repeat the same procedure for client2, etc. - i.e. in your case subtistute client1 for "dog" and client2 for "cat" and so on. All your client sites will be neatly organized in /sandbox and access via the server name or alias followed by port and path if present. For example, http://dog.localhost:8888 or maybe http://dog:8888/mypath/foobar.php using the alias and path in this example.

Using this method means the http://client1.localhost:8888 is easily identifiable as a LOCAL domain on your Mac when you have other browser windows open for staging and prod, for example.

Get the idea?

-jim
 
Last edited:

mcsolas

macrumors regular
Original poster
Jan 4, 2013
134
1
Get the idea?
-jim
Jim, thank you for your generous contributions to this thread. I am feeling pretty confident I can get mamp going now.

Now if I could just figure out how to reset that mysql password Im off and running.

edit - tried accessing it with sequel pro. coudn't connect even when the server was started. I am going to keep poking around. at the least that app is installed now. progressing along bit by bit.
 
Last edited:

rufhausen

macrumors regular
Jul 5, 2007
135
0
Littleton, CO
I don't think there's any right or wrong way to do this, but since switching from MAMP Pro, I've started using .dev for my local sites (inventory.dev, clientname.dev, etc.) and using the default ports. MAMP Pro has a Tools Menu that will turn off the built in Apache if there's a port conflict.
MAMP Pro will update your /etc/hosts file to allow your computer to resolve them properly:
127.0.0.1 cms.dev
127.0.0.1 inventory.dev

The other way I've done it is just make all of the sites port-based (localhost:9000, Localhost:9001, 9002, etc.). I then use the same ports on the Test server, on which I can't use name-based virtualhosts anyway.

Have you tried using 127.0.0.1 instead of localhost with Sequel Pro, or changing to whatever port you are using (8889?) if you are not using the default?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.