How do I install LiveCode Server on OS X with Apache?
The LiveCode Server product brings our english like language to the server environment. The server engine is a separate build of the LiveCode engine with specific syntax and functionality that makes it suitable for use in command-line contexts and, in particular, as a CGI processor.
This lesson will walk you through the steps required to install LiveCode Server on OS X with Apache.
This lessons assumes you have access to your system's Apache configuration files. If you do not, see the the lesson "How to install LiveCode Server with Apache via .htaccess?"
Prerequisites
Before starting, read the lesson "How do I install LiveCode Server".
Apache is the most most popular web server package available today. Installing Apache will allow your machine to function as a web server, hosting websites and serving web pages. By default, OS X comes with Apache installed with the relevant files being contained in the folder /etc/apache2/.
To start Apache run this command from the Terminal
sudo apachectl start
If you are using a custom install of Apache, you will need to ensure that the following three modules are enabled:
This lessons assumes you have access to your system's Apache configuration files. If you do not, see the the lesson "How to install LiveCode Server with Apache via .htaccess?"
Download LiveCode Server
Begin by downloading the LiveCode server zip file for OS X using the instructions detailed in the lesson "How do I install LiveCode Server?". Unzip the package into your desired location - for example in your home folder.
Ensure LiveCode Server is executable
You will need to ensure the executable bit is set on the livecode-server file and the LiveCode Server folder.
Execute these commands in the terminal to set the executable bits
sudo chmod 755 ~/<path to LiveCode Server Folder>/
sudo chmod 755 ~/<path to LiveCode Server Folder>/livecode-server
Accessing Apache configuration files

Next, you need to modify your Apache configuration files. To get access to you Apache configuration files, navigate to the folder /etc/apache2/.
To do this, open up finder, click on the "Go" menu, select "Go to Folder", type in /etc/apache2/ and click on "Go". This should open up a new finder window displaying the contents of the Apache folder.
Setup LiveCode Server as a CGI engine

The main Apache configuration file is "httpd.conf". In addition to "httpd.conf", each user has their own configuration file named "<username>.conf" located in the users sub-folder. Open up the configuration file for your user in TextEdit and replace its contents with the following:
<Directory "/Users/<username>/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
AddHandler livecode-script .lc
Action livecode-script /livecode-cgi/livecode-server
</Directory>
<Directory "<path to LiveCode Server folder>">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /livecode-cgi/ <path to LiveCode Server folder>/
Here <username> is the name of the user whose conf file you are editing and <path to LiveCode Server folder> is the full path to the folder you unzipped the LiveCode Server files into.
Important: These instructions apply to Apache v2.2. If you are using a newer version of Apache, you need to replace every occurence of:
Order allow,deny
Allow from all
with
Require all granted
Restart Apache

Once you have updated your configuration file, you must restart Apache. Do this by running the following command in the terminal:
sudo apachectl restart
Create & view a web page

You are now ready to test your installation. To do this, create a file named "test.lc" in the "Sites" folder in the home folder of the user you have configured for. The "Sites" folder is the location for all the user's web pages.
To access the test script, navigate to http://localhost/~<username>/test.lc. The above image shows the expected output if "test.lc" contains the following script:
For more detailed information on installing LiveCode server, see the server release notes distributed with the server package.
Trouble Shooting
If you cannot see the test page as expected you might need to change some other settings in the Apache configuration.
Ensure the required modules are enabled
To ensure the mod_cgi, mod_actions and mod_alias modules are enabled open the httpd.conf file in a text editor and ensure the following lines are uncommented.
LoadModule cgi_module libexec/apache2/mod_cgi.so
LoadModule actions_module libexec/apache2/mod_actions.so
LoadModule alias_module libexec/apache2/mod_alias.so
Ensure your Sites folder is accessible
To ensure your Sites folder is accesible you might need to make the following changes.
In the main httpd.conf file uncomment
LoadModule userdir_module libexec/apache2/mod_userdir.so
and
Include /private/etc/apache2/extra/httpd-userdir.conf
In extra/httpd-userdir.conf uncomment
Include /private/etc/apache2/users/*.conf
Allow LiveCode Server to run
In Catalina you might get messages that some of the LiveCode Server files are from an unidentified developer. If this happens you can run them anyway by opening System Preferences - Security & Privacy and choosing "Open Anyway" or choosing "Open Anyway" in any dialogs that popup.
This will be addressed in a future version of LiveCode Server.
The "AddHandler" directive can take more than one suffix. Like this:
AddHandler livecode-script .lc .irev
So if some of your HTML/LiveCode pages are named with the .lc suffix and others have the .irev (or some other) suffix, you can include both suffixes in "AddHandler" and all your LC pages will be handled correctly.