Working on your website locally is a very common practice among WordPress developers. It is quite simple to set up and optimizes the development process. For those less knowledgeable about WordPress, this can be a great tool to explore and enhance your existing knowledge. Fortunately, there are several free web development tools that can be used. In this article, we will cover one called MAMP.
MAMP was originally designed for the Macintosh (i.e. macOS) but has since expanded to Windows, while retaining the name. MAMP stands for Macintosh, Apache, MySQL and PHP. Apache is an open source web server, MySQL is an open source relational database management system, and PHP is a server-side coding language on which WordPress is built. As such, using MAMP can be useful for many WordPress users, as you will soon discover. We will explore it in more detail in the next section. Next, we’ll show the exact steps to set up both MAMP and WordPress:
Why Should You Install WordPress Locally on Mac Using MAMP
There are many reasons why a local WordPress installation using MAMP can be beneficial. The first and most common is wanting a safe environment to test updates before applying them to a live site. As mistakes can be very costly i.e. your website can break down, it is important to fully test all code changes beforehand, whether or not done by yourself. Along the same lines, a local installation can also serve as a backup for your current site. Also, working locally is faster as it bypasses internet accessibility problem and connection issues, as well as server issues. Finally, local installations have a reduced risk of acquiring malware or being hacked.
How to Install WordPress Locally on Mac Using MAMP
Now that we’ve touched on the many benefits of having a local WordPress installation using MAMP, we’re moving on to the practical part of the article. We have divided the installation process into four parts and carefully and thoroughly explained each of them. The step-by-step explanations are accompanied by screenshots so you can easily follow along.
Installing MAMP on a Mac Computer
The first step is to download the MAMP software and install it on your computer. To do this, simply go to the MAMP Information website and click on the Free download connect.
Once the download is complete, you will need to double click on the downloaded file to start the installation. Next, just follow the on-screen instructions. For the most part, you will only have to click on the To continue button and accept the license agreement.
When you get to the last window, click it close button to complete MAMP installation on your device.
Please note that the download package includes MAMP and MAMP Pro (paid version), so both will be installed on your computer. So when you launch MAMP after installation, you have to be sure to open and use the free version.
You can do this by going to Applications > MAMP folder on your computer.
After opening the MAMP folder, find the elephant icon inside and click on it to start the MAMP application.
*Bonus tip
Before continuing further, we wanted to mention that there is some changes to MAMP settings you can make now so that working in MAMP will be easier for you in the long run. The first of these changes is change apache port. Open the Preferences menu under MAMP, then click the Ports tab.
In the Apache port field, enter 80, then click OK to save the change. Alternatively, you can press the button with Set web and MySQL ports to 80 and 3306 to change Apache port with MySQL port.
By changing the Apache port to 80, you will be able to access your local websites using http://localhost as a link instead of http://localhost:8888. However, this also means that every time you start the MAMP servers you will need to provide your device admin password.
Another thing you can change to improve the user experience is choosing the root directory for your documents. This is where your local websites will be stored. The default location that MAMP uses is /Applications/MAMP/htdocs/ case. However, you can easily change this if you wish. Access the Preferences menu, click on the Web Server Tab, then To select a folder you can easily access to install MAMP. This will help you in the long run as you will keep all your site files in MAMP’s htdocs subdirectory. Ideally, you should store each of your websites in a new folder in this subdirectory.
On our side, we will keep the default file path.
Once you have adjusted these options according to your preferences, you can proceed to install WordPress locally by starting the server. Click it Start the servers in the MAMP application window. If you changed the Apache port to 80 previously, you will be prompted for your computer’s administrator password.
Downloading WordPress Files
Now that MAMP is installed and working, we need to add WordPress to the localhost website. Download the latest version of WordPress from official site by clicking the Download WordPress button in the middle of the screen. At the time the article was written, the latest version was 5.3.2, so yours may differ.
Once the download is complete, you will need to navigate to the folder where you installed MAMP and navigate to the htdocs subfolder within it—in our case, we used the default path /Applications/MAMP/htdocs/. If this is different for you, navigate to the folder you previously specified for MAMP, then navigate to the htdocs subfolder. You should create a new folder for your site here. As mentioned earlier, you should store each of your website files in a new folder within the htdocs directory. The name of this folder will be part of the URL used to access your site. For example, if you name the folder my website, you will access your site by going to http://localhost/mysite in your favorite browser.
Once the folder is created, open it and extract the contents of the WordPress installation file you downloaded earlier in this one.
Create a database for WordPress
Open your browser and navigate at http://localhost/MAMP/.
Click on the TOOLS tab, followed by a click on the PHPMYADMIN option from the drop-down menu.
The phpMyAdmin is a web application used for the administration and management of MySQL databases. When you open it, you must click on Data base then create a new database. You can name this database whatever you want, but make sure you remember the name as you will need it in the next step. We will name our database my database. In addition, be sure to choose Snack from the drop-down list before clicking the Create button.
Voila, you now have a database for your site.
Installing WordPress locally via the on-screen installer in the browser
After creating the database, open your browser, and go to http://localhost/mysite/ to start installing WordPress. The first thing you will have to do is choose language you will use.
On the next screen, WordPress will list the required information you need to complete the installation. Click on the let’s go button.
Next, you will be asked to enter your WordPress database information. Here you should enter exactly the following information
You can leave the last two fields as they are.
Once you click TP submit you will be able to see a notification that the first game is over. Clicking on the Run the installation button will begin the famous WordPress installation process in five minutes.
When the installation is complete, you will need to fill in the Information required form, and click the Install WordPress button basically. You do not have to check the box to Discourage search engines of the indexing of this site because search engines cannot index a site created in a local environment.
Once WordPress installed, a success! message will appear. Click on the Login button to go to login page.
Now you must insert username and password you chose earlier and press the Connect button again.
After successfully logging in, you should see the dashboard panel that concludes the installation process.
You can now continue working on your site using a local environment. Please note that when you want to work on your site, MAMP must be running for localhost to work.
Final Thoughts
As you have seen, installing WordPress locally on Mac using MAMP only requires a few steps and can be done in a short time. Using MAMP for WordPress will allow you to work on your site in a safe and controlled environment. You will be able to practice your WordPress skills, develop sites for clients, test tricky changes and much more. All in all, this is a very valuable asset for quickly creating great-looking websites and maintaining the functionality of existing websites. So whatever you want to do with your website and MAMP, we hope you found this tutorial useful and will use it in the future.