I wanted to make a local domain and a starting home page on my Mac to aid in local web development and gather common links. Fortunately, on macOS this is a mostly-solved problem. I chose to use Valet (macOS) and Homepage.
Valet is a quick and easy way to start serving web pages from your Mac, without diving into configuration files. It allows you to set up a local domain such as .test (by default), or change it to something different. I use .app for my install. Valet can monitor a folder, such as the Sites folder that macOS used to use for Web sharing. Any sub-folders there (they can be real folders or links to folders elsewhere on your Mac) become locally-served sites.
If we have the folders
homepage under the Sites folder…
~/Sites hannagoodbar homepage
…they will be served with
http://homepage.test You can add or remove folders from there as needed. For me, Homepage is my default page for new windows and tabs, and hannagoodbar is for final proofing before deploying web site changes.
These instructions are for macOS. If you use Windows, here is the Valet for Windows page.
Most of these instructions come from the Valet installation page.
- I already have Nginx running on port 80, so it needs to be stopped (it was installed via Homebrew):
sudo brew services stop nginx
- Make sure Homebrew is up-to-date:
- Install PHP:
brew install firstname.lastname@example.org
Brew indicated PHP was already installed:
php 7.2.11 is already installed and up-to-date
- Install Composer, a PHP dependency manager:
brew install composer
- Download Valet:
composer global require laravel/valet
- Add the Composer path to my shell’s path. I edited my
- Activate the .zshrc changes:
- Install Valet:
Here is where Valet configuration begins.
- Change the default Valet domain from
valet domain app
- Make a directory for Valet to serve web pages:
- Instruct Valet to use this folder to serve web pages:
cd ~/Sites && valet park
We are now ready to serve some web pages locally.
From the project’s GitHub page: “This project is a simple, standalone, self-hosted PHP page that is meant to be your window to your server and the web.” It’s your local, um, home page.
The home page shows you a random image from Unsplash. Press the space bar to activate the menu, time, and Unsplash image credit.
Since we have Valet going, it’s just a few steps to get Homepage running.
- Download Homepage from the GitHub page
- If you want to see Unsplash images, register as a developer at https://unsplash.com/developers and get your 64-character client ID.
- Extract to the folder where Valet is “parked”; for me, this is
- Homepage should be a folder inside, so
- Supply your Unsplash developer ID in
- Edit or add links to your favorite sites. By default, only Font Awesome icons are used.
You should now be able to navigate to
http://homepage.test and see it.