USING MAMP TO DEVELOP WORDPRESS THEMES, PLUGINS AND SITES ON YOUR MAC
Part 3 of 3: Uploading your Work to your WordPress Host
Once you have completed development of your WordPress Theme, Plugin, or website on your Mac using MAMP (the set up for which was described in parts 1 and 2 of this series), you’ll be ready to “push” your code to your online host. If you don’t yet have a WordPress host, check out these online reviews to find a quality one. You’ll want to make sure that the host provides support for FTP or other file upload functions, so you can move your work from your desktop to the internet.
The process of pushing your code from your local machine to the host requires you to make sure the MySQL database, the file paths, and your WordPress configurations are in sync, in addition to moving your code from your Mac to the server. Then you’ll need to do some clean up to make sure that everything matches cleanly.
Before getting started it’s a good idea to make backups of your work on your local machine and, if there’s already a site online, one of your hosted environment. For the former, if you have Time Machine enabled on your Mac, you may want to run it, or any other backup tool like Carbonite or iDrive. For your hosted environment, you’ll probably need to login to the control panel for your hosting account, which may be through cPanel, Plesk, or in some cases your host’s custom tool. Make the backups as instructed in your hosting provider’s knowledge base or FAQs before proceeding.
I. Database Tasks
First and foremost, you’ll need to prepare your database for export and upload. This will be done primarily through the phpMyAdmin portal, with the help of your favorite text editor.
1. Export your local database files from your phpMyAdmin portal:
- Start your local server by launching MAMP and clicking “start servers,” then go to the WebStart page in your web browser
- Go to phpMyAdmin
- Find the database you were using for your development work on the left. In our example in part 2, we called it
myexampledb– find and click on the name of your database.
- Go to “export” on the top menu and choose “Quick Export,” and set SQL as the format
- Click “Go” and an SQL file will be created and then downloaded into your default downloads folder you have set for your browser
If the phpMyAdmin Export tab doesn’t automatically download the file for you, you need to click on the “custom” radio button, and then in the section that is titled “Output” select “Save output to a file,” but keep all the defaults.
2. Edit the File Paths in SQL
You’ll need to modify the file paths in the database because the paths you used while developing WordPress locally were “absolute” paths. They should be changed to match the paths for your online domain name as follows:
- Open the SQL file you just exported using your favorite text editor (we like BBEdit) or IDE (such as Xcode)
- Find all paths that used
localhostin the name such as
http://localhost/myexampledband replace them with the URL of your hosted site’s domain, such as
Note: the path to ‘/myexampledb’ will depend on where it’s located online; if it is in the root folder then it’ll just be entered as ‘/’ but if it is in another folder you’ll need to enter the leading path such as ‘/foldername’
3. Create a New Database on your Hosting Account
You’ll need to create a database with a matching name on your host, this is where you’ll upload the edited SQL file above.
- Go to your host’s Control Panel environment such as cPanel or Plesk and find where the MySQL databases are managed. Select ‘MySQL’ databases.
- You may be asked to enter a username and password. The database will usually have the same name as the username you set here.
4. Upload the SQL Database file
- In your hosted environment, go to phpMyAdmin. This will most commonly be via the host’s Control Panel.
- In phpMyAdmin, select the “Import” tab in the admin area as shown in the image below
- Browse to the location of the SQL file you exported and edited on your desktop, then import this to your server
II. Adjust WordPress Configurations
To work with the online host settings and database, you’ll need to modify the WordPress
wp-config.php file, the same one edited in Part 2 of this series. You’ll need the details of the username and password for the online database created in the last step above.
- Copy your wp-config.php file from your local WordPress installation folder and place it in a different location. If you just edit it in place, your local install will stop working
- Open the wp-config.php file in a text editor
- Change your_database_name in the line
define(‘DB_NAME’, ‘your_database_name’);to the same database name you created above (it may currently have your local database name there)
- Change your_database_user in the line
define(‘DB_USER’, ‘your_database_user’);to the same username you created above (it may currently have your local database username or the word ‘root’ there)
- Change your_database_password in the line
define(‘DB_PASSWORD’, ‘your_database_password’);to the same password you set above (it may have your local password or the word ‘root’ there)
- Lastly, you’ll want to either leave
define(‘DB_HOST’, ‘localhost’);as is or change the part that says localhost to your server IP address – you need to check your host’s documentation to see which is required.
- Save this updated wp-config.php file and note the location. In the next step, when you upload your files, you’ll want to overwrite the wp-config.php file on the host server with this one.
III. Upload your Files
At this point, you will want to move your local WordPress files to the server via the host control panel or via FTP. If the control panel provides this feature, you’ll need to check your host’s documentation for accessing the location of your WordPress install. To use FTP requires an FTP client, which is desktop software for your Mac that uses the File Transfer Protocol.
Quite a few FTP clients are available for Mac as both free and paid software. In addition to providing the FTP mechanism to move files between your desktop to a server or back, these tools vary in their user interfaces, which makes some easier to use than others. We recommend CyberDuck as an FTP client for Mac.
You’ll need to check the instructions or “read me” files for your FTP client for specific usage directions, but they’re usually “drag-and-drop.” Once connected to your Web Server, the FTP client will show it as a location like a desktop folder; you can then drag files from your local machine onto the server folder. The FTP software will transfer the files up to the server.
You can choose to upload only your custom files if you have a WordPress install already running online, or upload all of your local WordPress files. As long as the versions of WordPress are the same, there should be no issues. You’ll want to make sure the wp-config.php file you edited above is the final one on the server.
- Launch your FTP client and connect to your host’s FTP service. You will likely need to provide a username and password; check your host for support on this
- Log in and connect to the host
- Browse to your public_html or www folder, or the root of your WordPress install as designated by your host in their documentation
- Use the FTP tool to copy the relevant code and WordPress files from your local to the server. Make sure you move the newly edited wp-config.php file to the right location
IV. Clean Up
To finalize the process, you’ll need to make sure the permalink structure of your WordPress site online is correct, via your WordPress Admin area.
- Login to your WordPress admin dashboard
- Go to Settings > Permalinks
- Select the same structure used on your local set up and click save
Your WordPress install on your host should now be running the same as on your local Mac! Test out your newly developed Theme, Plugin, or website and make sure it runs the same.
Congratulations on pushing your code to the server!