⚠️ These instructions may not work on Chrome due to an unknown problem with SSL. At the moment I'm unsure of the cause or how to fix it. Firefox has been tested and works.
While I've tried to make these instructions fairly comprehensive, some knowledge of the command line will be helpful when following this guide.
You may find it useful to cross reference with the official Rehike install guide, in case I've missed something or new information is added before I can update this guide.
The minimum macOS version listed has not been extensively tested and is solely based on claims from XAMPP and MacPorts's "Port Health" sections for Apache and PHP 8.
To install Rehike you currently need the following prerequisites:
- Apache
- PHP 8.0 or greater
- Mac OS X 10.7 (Lion) or higher, running on an Intel or Apple Silicon Mac
- Git (recommended but optional)
A version of Apache is present on your Mac out of the box, but it's not recommended for use here. It's likely out of date, and as of macOS Monterey, no longer includes PHP.
XAMPP is a simple and easy way of installing Apache and PHP. You can uncheck the rest of the components in the installer. We only need Apache and PHP for these purposes.
- Included with your XAMPP installation is a graphical app for managing your Apache server. This app is not useful for this guide—everything will be done through the terminal.
A package manager such as Homebrew or MacPorts is recommended to install Git.
- Note that Homebrew only supports macOS 11 (Big Sur) and up. If you're on 10.15 (Catalina) or lower, you must use MacPorts.
As mentioned in the last section, you're highly encouraged to use Git to install Rehike. This way you can easily pull new Rehike updates with git pull
.
Full instructions on how to update this way are available later in the guide.
Find the web root of your Apache installation. Using XAMPP, it's /Applications/XAMPP/xamppfiles/htdocs
.
Change to the directory that contains the current web root.
cd /Applications/XAMPP/xamppfiles
Now we'll replace Apache's default web root folder with Rehike.
- You might need to run these commands with sudo.
rm -r htdocs
git clone https://github.com/Rehike/Rehike htdocs
Restart Apache for the changes to take effect.
sudo /Applications/XAMPP/xamppfiles/bin/apachectl restart
Advanced users: You may find it convenient to add an alias for /Applications/XAMPP/xamppfiles/bin/apachectl
in your bashrc or zshrc.
Rehike should now be your new web root. You can test by navigating to localhost
in your browser.
Download the first linked file in this section of the Rehike documentation by clicking on the first link.
Then, to download the second file, right click the second link and select Save Link As. (if using Firefox/Chrome - in Safari it's called Download Linked File). You may need to add .pem
to the end of the file before saving if it is not there already. If there is no file extension, like in this example, your browser will save it as a text file instead of a certificate.
You should get a zipped folder named apache_conf_ssl.zip
from the first link and a certificate file named rehike_master_cert.pem
from the second.
A more detailed explanation of their purpose is also available at that page.
Unzip the apache_conf_ssl.zip
you downloaded in the previous step. You should see what's in the picture below. Copy all 3 items to /Applications/XAMPP/xamppfiles/etc/conf
. Hold on to this folder, it's also needed in the next step.
Now, double-click the rehike_master_cert.pem
certificate. The Keychain Access app should open up. Ensure the login
keychain is currently selected in the menu on the far left.
Without closing Keychain Access, bring up the Finder and navigate back to the folder you copied the Apache certificates from. Inside the ssl.crt
folder should be a file called server.crt
. Double click it and Keychain Access should be brought to the front. If not, just bring it up manually.
Scroll down to the bottom of the list and you should see two certificates named www.youtube.com
.
One by one, right click on each of the two www.youtube.com
certificates and select Get Info. Ensure that the Subject and Issuer for both certificates is Taniko Yamamoto
.
Now while Get Info is still open on both certificates, click to expand the Trust section. Change When using this certificate:
to Always Trust
for each certificate. Click the close button on the Get Info windows and authenticate yourself when prompted.
Open the file /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf
in your text editor of choice. Add the following designation to the end of it:
<VirtualHost 127.0.0.1:443>
ServerName www.youtube.com
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
SSLEngine on
SSLCertificateFile "etc/conf/ssl.crt/server.crt"
SSLCertificateKeyFile "etc/conf/ssl.key/server.key"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Next, open /Applications/XAMPP/xamppfiles/etc/httpd.conf
in your text editor. Find the Listen section. There should be a line reading Listen 80
already there, near line 50 or so. Underneath it, on a new line, add Listen 443
.
Restart Apache for the new configuration to take effect.
sudo /Applications/XAMPP/xamppfiles/bin/apachectl restart
Open /etc/hosts
in your text editor of choice. Ensure you run the editor with sudo. In the example, I use nano to edit.
sudo nano /etc/hosts
This file is important for manually defining DNS resolutions. Avoid editing any entries that are already there.
Underneath the existing localhost
entry at the top, while above the broadcasthost
line, manually type in the following additions:
127.0.0.1 www.youtube.com
:: www.youtube.com
127.0.0.1 youtube.com
:: youtube.com
It should look something like the image below. Note the placement of my own entries: underneath the first localhost
but above broadcasthost
. Single-line comments are supported with hashes: ## like this
if you want to leave yourself a note.
Double check your work. When you're sure you're done, save the file and exit your editor.
Advanced users: you could try adding /Applications/XAMPP/xamppfiles/bin/apachectl start
to your crontab, but I don't know enough about cron to properly test this.
A simpler solution is creating a workflow in Automator. Open Automator and click New Document
at the bottom of the window that pops up. Select the Application type and click Choose
. In the search bar, look for Run Shell Script
and drag it into the workflow view on the right.
In the shell script text box, just enter /Applications/XAMPP/xamppfiles/bin/apachectl start
and save the application in Automator.
Now open System Preferences and navigate to Login items
. On Ventura it's under General. At the top there should be a list of apps you have set to open when you login. Regardless of how populated the list is, there should be a plus on the bottom left of it. Click it and add your new Automator app. Now the command to start Apache should run when you log in.
Having Git installed will be required for these steps. I won't be providing instructions on how to update Rehike without Git in this guide, as it's much more time consuming and not recommended. Refer to this section of the official Rehike documentation instead, if necessary.
To update Rehike, first open your terminal and change directory to where you previously installed it:
cd /Applications/XAMPP/xamppfiles/htdocs
Now, just run:
git pull
The resulting message will depend on whether Rehike has updated or not. If you see Already up to date
, there is currently no update. If you see something more like this, then there was an update. Rehike is still in active development, so try to check for updates at least every few days so you don't miss out on new fixes and changes.
Advanced users: You may find it useful to automate this to run at every startup.
Tried loading YouTube but just see an error that looks something like this?
This is likely a result of improperly set up certificates. Open Keychain Access and ensure you have two www.youtube.com
certificates. Make sure both are issued by Taniko Yamamoto
and the trust is set to Always Trust
on both.
Safari will always see the certificates as "not standards compliant" if the system isn't told to Always Trust them. This usually also applies to other WebKit browsers.
If you try starting Apache and it throws an error saying the port or address is in use, this may be a conflict with macOS's built in version of Apache. Many macOS versions come with older, now outdated versions of Apache out of the box.
You'll need to disable the built in Apache altogether with the following commands:
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
If the second command throws an error, such as this, try running this instead:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
Check your httpd.conf
and ensure your ServerRoot
is set to the right directory.
While in httpd.conf
, search for the Virtual hosts
line (command+F) and ensure the line below it is not commented out. It should look like this:
This is likely due to Rehike not being able to write to its install directory. Run the following command to fix this:
chmod -R 777 /Applications/XAMPP/xamppfiles/htdocs
Also check out the troubleshooting section of the official Rehike guide. There are more general troubleshooting steps available there. I mainly wanted to focus on macOS specific problems in this section.
please just make a video about it