Testing TNG on MacOS

From TNG_Wiki
Jump to navigation Jump to search

So you want to install TNG on macOS for testing purposes? This page contains instructions for getting TNG running without having to install or configure a web-server like Apache or Nginx. The instructions assume you know how to launch the macOS Terminal for executing shell commands and are comfortable adding MySQL databases and users manually (3 instructions, detailed below).

If you're planning on hosting an Internet accessible TNG site on macOS, you should use Apache with the PHP plugin and consider a solution like MAMP or use the instructions for setting up Apache with PHP and phpMyAdmin found here.

Checking (or upgrading) PHP

PHP is installed by default on macOS and any PHP version greater than 5.2.3 is sufficient for running TNG. To check the version of PHP on your Mac, execute:

/usr/bin/php -v

... from the command line.

If you need a more recent version of PHP, try this tutorial with instructions on replacing the PHP version on your Mac.

Preparing MySQL for TNG

Installing and Running MySQL

The MySQL database management system (DBMS) is what holds all your TNG data, and you'll need it on you Mac in order to run TNG. MySQL does not come installed on macOS by default. So you'll need to install it yourself. Start by downloading a version of the MySQL Community Server (freeware) from mysql.com.

As of this writing, the current version of MySQL is 5.7.17 which should be good for TNG and will run on Sierra (10.12) El Capitan (10.11) and Yosemite (10.10). I recommend getting the .DMG package which makes installation easier.

Double-click the .DMG package and follow the installation instructions. WARNING: If you already have MySQL and databases installed on your Mac, this process may wipe these databases out. The installer will ask you to create a password for the 'root' MySQL account. Enter and save that password, you'll need it later.

Once you've installed MySQL, test to ensure it's running by using the MySQL System Preferences panel:

System Preferences -> MySQL

You can start also start the server if it isn't running. You'll need to be an 'admin' user and will have to enter your login password.

Creating a TNG Database and User

From the command-line, enter MySQL by executing the following command and typing in the password for the MySQL root account (which you created earlier) at the prompt:

mysql -u root -p

Once in the MySQL command shell (indicated by "mysql>"), enter the following three commands to create a TNG database and database user. (Substitute a database name, db user name, and a db user password where the angle brackets indicate.):

mysql> create schema <db_name> default character set utf8;
mysql> create user '<db_user>'@'localhost' identified by '<password>'
mysql> grant all on <db_name>.* to '<db_user>'@'localhost'

Installing and Starting TNG

Installing TNG

Download a clean copy of TNG and install it in a directory of your choosing. Record the full path to your site since you will need it in the next step.

Starting a PHP Web-server

Start a PHP web-server by executing the following command providing the root location of your TNG installation. (The author recommends using the full path to your TNG installation here):

php --server localhost:3030 --docroot <your-TNG-site>

If you need to start PHP with certain parameters add the location of your PHP .ini file to the startup command:

php --server localhost:3030 --php-ini <your-php-ini-file> --docroot <your-TNG-site>

Configuring TNG

Using a web-browser open your TNG site using the URL:

http://localhost:3030/readme.html

This should take you to the local copy of the instructions page where you can begin the process of configuring TNG. Following the Express Installation instructions, but...at step 6, when establishing a database connection, if 'localhost' fails substitute '127.0.0.1' and try again.

At this point you should have a fully functioning local installation of TNG on your Mac. You can create as many installations as you need, remembering to use the root of the installation you want to run in the command to start PHP. I you are using macOS to test TNG and you have multiple installations using different TNG revisions, the author recommends creating separate databases for each. This helps to ensure that a database upgrade (sometimes a part of Darrin Lythgoes' upgrade procedures) doesn't make a particular database incompatible with the TNG site you wish to use.

Starting TNG After Installation

After installing TNG with the above instructions, you can restart it anytime by starting MySQL via System Preferences and then executing:

php --server localhost:3030 --docroot <your-TNG-site>

...from the command-line.