# A.3 Instructions for Mac OS Users

### The instructions in this section are specific to user of Mac OS systems.

{% hint style="success" %}
Users of other Unix based system such as Linux or Ubuntu may find some of the instructions in this section applicable in their environment. However, the location of MySQL configuration files may differ and as a result some aspects of the configuration process may need to be altered.
{% endhint %}

### Users of Window systems should skip to [A.4 Instructions for Windows Users](/snomed-ct-practical-guides/snomed-ct-sql-practical-guide/appendices/appendix-a-building-the-snomed-ct-example-database/a4-instructions-for-windows-users.md).

## MySQL Installation (MacOS) <a href="#title-text" id="title-text"></a>

{% hint style="info" %}
**Info**

The instruction in this section assume you are installing MySQL for the first time or have fully uninstalled an earlier installation.\
If MySQL is already installed you may choose to skip this section.

**Note**

if MySQL was installed using a different installation package, some of the configuration steps described in later sections may need to be modified.

Please refer to <https://www.mysql.com/products/community/> for detailed information about MySQL.
{% endhint %}

### Install MySQL Community Server

* Download and install the **DMG Archive** version of the [MySQL Community Server](https://dev.mysql.com/downloads/mysql/).
* During the installation process you will be prompted to provide a password for the MySQL server root account.
  * **Make a note of the root password** - you will need to use it to load the SNOMED CT release package.
* Select the **Legacy Authentication Method** unless you will be using the database for other purposes that require greater security.

### Install MySQL Workbench

* Download and install the **DMG Archive** version of the [MySQL Workbench](https://dev.mysql.com/downloads/workbench/).

## Set Required MySQL Configuration (MacOS) <a href="#title-text" id="title-text"></a>

### Open the **Terminal** Application <a href="#a.3.2setrequiredmysqlconfiguration-macos-opentheterminalapplication" id="a.3.2setrequiredmysqlconfiguration-macos-opentheterminalapplication"></a>

<div align="left"><figure><img src="/files/QIvZ9bSlvU1geM6jke5F" alt=""><figcaption></figcaption></figure></div>

Type the command lines shown below into the terminal window.

#### Change Directories to the *SnomedRfsMySql* Folder <a href="#a.3.2setrequiredmysqlconfiguration-macos-changedirectoriestothesnomedrfsmysqlfolder" id="a.3.2setrequiredmysqlconfiguration-macos-changedirectoriestothesnomedrfsmysqlfolder"></a>

<table data-header-hidden><thead><tr><th width="135.2421875"></th><th></th></tr></thead><tbody><tr><td><div><figure><img src="/files/DnREQJd6fWPQM6L1vA6R" alt=""><figcaption></figcaption></figure></div></td><td><div><figure><img src="/files/nDn7mvOmRxRXqc244q1q" alt=""><figcaption></figcaption></figure></div></td></tr></tbody></table>

#### Make the Scripts in the *bash* Subfolder Executable <a href="#a.3.2setrequiredmysqlconfiguration-macos-makethescriptsinthebashsubfolderexecutable" id="a.3.2setrequiredmysqlconfiguration-macos-makethescriptsinthebashsubfolderexecutable"></a>

<table data-header-hidden><thead><tr><th width="140.16015625"></th><th></th></tr></thead><tbody><tr><td><div><figure><img src="/files/lbnIteDsvt3vjyvmnmFm" alt=""><figcaption></figcaption></figure></div></td><td><div><figure><img src="/files/fzRkgC1PB64qhGNul46H" alt=""><figcaption></figcaption></figure></div></td></tr></tbody></table>

{% hint style="success" %}
**Tip**

If this command does reports an error, please try the following modified command, which may prompt for your password to confirm the action:

```
  sudo chmod u+x bash/*
```

{% endhint %}

#### Run *snomed\_config\_mysql* Script to Configure MySQL <a href="#a.3.2setrequiredmysqlconfiguration-macos-runsnomed_config_mysqlscripttoconfiguremysql" id="a.3.2setrequiredmysqlconfiguration-macos-runsnomed_config_mysqlscripttoconfiguremysql"></a>

{% hint style="info" %}
This script requires you to have administrator rights to access your computer and may prompt you to enter your login password. If you do not have administrator rights to access your computer, you will need to ask someone who does have those rights to run this part of the process.
{% endhint %}

<table data-header-hidden><thead><tr><th width="154.46484375"></th><th></th></tr></thead><tbody><tr><td><div><figure><img src="/files/z4pwtWYt8RGVJuc4H0RA" alt=""><figcaption></figcaption></figure></div></td><td><div><figure><img src="/files/JVyJe8r3tCmylbFryfjD" alt=""><figcaption></figcaption></figure></div></td></tr></tbody></table>

#### Close the Terminal Application Window <a href="#a.3.2setrequiredmysqlconfiguration-macos-closetheterminalapplicationwindow" id="a.3.2setrequiredmysqlconfiguration-macos-closetheterminalapplicationwindow"></a>

* You have now completed the configuration process.

### Start or Restart the MySQL Server <a href="#a.3.2setrequiredmysqlconfiguration-macos-startorrestartthemysqlserver" id="a.3.2setrequiredmysqlconfiguration-macos-startorrestartthemysqlserver"></a>

{% hint style="info" %}
**Info**

The MySQL Server must be started (or stopped and restarted) to apply the required configuration settings.
{% endhint %}

#### Open the Mac OS **Settings** Application <a href="#a.3.2setrequiredmysqlconfiguration-macos-openthemacossettingsapplication" id="a.3.2setrequiredmysqlconfiguration-macos-openthemacossettingsapplication"></a>

<div align="left"><figure><img src="/files/eSJH0Pgf8lKHJxwBVu5I" alt=""><figcaption></figcaption></figure></div>

#### In System Preferences Search for MySQL <a href="#a.3.2setrequiredmysqlconfiguration-macos-insystempreferencessearchformysql" id="a.3.2setrequiredmysqlconfiguration-macos-insystempreferencessearchformysql"></a>

<figure><img src="/files/1VOGdoWiaxYHdY5zTalM" alt="" width="500"><figcaption></figcaption></figure>

#### Click to Open the MySQL Dialog <a href="#a.3.2setrequiredmysqlconfiguration-macos-clicktoopenthemysqldialog" id="a.3.2setrequiredmysqlconfiguration-macos-clicktoopenthemysqldialog"></a>

<figure><img src="/files/dm77Lqb353Pk5L6TzrQH" alt="" width="563"><figcaption></figcaption></figure>

#### Stop MySQL Server (if it is running) <a href="#a.3.2setrequiredmysqlconfiguration-macos-stopmysqlserver-ifitisrunning" id="a.3.2setrequiredmysqlconfiguration-macos-stopmysqlserver-ifitisrunning"></a>

If MySQL is running the dots are green (as shown above).

* Click **Stop MySQL Server** and wait for the dots to turn red (as shown below).
  * You will be prompted for your Mac password to confirm this action.

<figure><img src="/files/s75B8JAGlqUh9u7RICjX" alt="" width="504"><figcaption></figcaption></figure>

#### Start MySQL Server <a href="#a.3.2setrequiredmysqlconfiguration-macos-startmysqlserver" id="a.3.2setrequiredmysqlconfiguration-macos-startmysqlserver"></a>

When the dots are red (as above) MySQL is not running

* Click **Start MySQL Server** and wait for the dots to turn green.
  * You will be prompted for your Mac password to confirm this action.

## Load Release Package into MySQL (MacOS) <a href="#title-text" id="title-text"></a>

{% hint style="danger" %}
**Disk Space**

Before running the SNOMED CT load script, ensure you have at least 10Gb of free disk space. Once the load is completed 4Gb can be released by deleting the Release package folder and zip file.

The following figures apply to the SNOMED CT International Release package 2019-07-31.

* Release Package zip file: 0.5 Gb
* Release Package folder: 3.5 Gb
* Installed database up to: 5.5 Gb
  {% endhint %}

### Open the Terminal Application <a href="#a.3.3loadreleasepackageintomysql-macos-opentheterminalapplication" id="a.3.3loadreleasepackageintomysql-macos-opentheterminalapplication"></a>

<div align="left"><figure><img src="/files/DUrdUEHCiho0QCtePGUW" alt=""><figcaption></figcaption></figure></div>

#### Change Directories to the SnomedRfsMySql Folder <a href="#a.3.3loadreleasepackageintomysql-macos-changedirectoriestothesnomedrfsmysqlfolder" id="a.3.3loadreleasepackageintomysql-macos-changedirectoriestothesnomedrfsmysqlfolder"></a>

You must change directories to the SnomedRfsMySql folder before starting the loader script.

<table data-header-hidden><thead><tr><th width="131.01953125"></th><th></th></tr></thead><tbody><tr><td><div><figure><img src="/files/ZjmHq092byYoqV3m6ba0" alt=""><figcaption></figcaption></figure></div></td><td><div><figure><img src="/files/qYSqLVdFGW3fu7KiZJYj" alt=""><figcaption></figcaption></figure></div></td></tr></tbody></table>

#### Start the SNOMED CT Loaded Script for MySQL <a href="#a.3.3loadreleasepackageintomysql-macos-startthesnomedctloadedscriptformysql" id="a.3.3loadreleasepackageintomysql-macos-startthesnomedctloadedscriptformysql"></a>

As shown above you must be in the **SnomedRfsMySql** folder to run the loader script. Additionally as shown below you must include the name of the subfolder (**bash**) when running the loader script. The script may not run correctly if called from a different current folder or without the including the subfolder name.

<table data-header-hidden><thead><tr><th width="132.55859375"></th><th></th></tr></thead><tbody><tr><td><div><figure><img src="/files/xmUPM9WIV7apUgYlaLAD" alt=""><figcaption></figcaption></figure></div></td><td><div><figure><img src="/files/PrcJfVDIXBHHbFwUcg16" alt=""><figcaption></figcaption></figure></div></td></tr></tbody></table>

#### Respond to Prompts from the Script <a href="#a.3.3loadreleasepackageintomysql-macos-respondtopromptsfromthescript" id="a.3.3loadreleasepackageintomysql-macos-respondtopromptsfromthescript"></a>

You will be prompted to enter the following data when the script is run.

<table data-header-hidden><thead><tr><th width="239.69921875"></th><th width="272.2265625"></th><th width="476.63671875"></th></tr></thead><tbody><tr><td><strong>Prompt</strong></td><td><strong>Response options</strong></td><td><strong>Notes</strong></td></tr><tr><td><strong>Loader script identifying tag</strong></td><td>Leave blank to accept the default<br></td><td><strong>Recommended option</strong><br>Uses the default <strong>create_latest</strong> script in the SnomedRfsMySql package.</td></tr><tr><td><strong>Loader script identifying tag</strong></td><td>Enter the name of one of the available scripts (these are listed above the prompt)</td><td><p>Uses the specified script to control the process of loading the SNOMED CT data into the database.<br>Scripts keys have two parts a prefix and suffix separated by an underscore. The prefix indicates the kind of action:</p><ul><li><strong>create :</strong> Create a new database and load the data from the specified version.</li><li><strong>update</strong> : Update the views and procedures in the database without recreating the database or reloading the the tables.</li><li><strong>extend</strong> : Extend the database by loading data from another package to the existing database.</li></ul><p>The suffix indicates the edition and version to which this applies:</p><ul><li><strong>latest</strong> : The most recent International Edition package</li><li><em><strong>yyyymmdd</strong></em>: The International Edition for the stated year month and day</li><li><em><strong>packageyyyymmdd</strong></em>: The identified Edition or Package for the stated year month and day.</li></ul></td></tr><tr><td><strong>Release package path</strong></td><td><p>You must enter the full path of the release package folder or release package zip archive.</p><p><em><strong>You will not be prompted for this if you select an update script option.</strong></em></p></td><td><p>The path specified must point to a release package zip archive or an unzipped release package folder.</p><ul><li><p>There is no need to include the .zip extension when referring to a release package archive or folder.</p><ul><li>The script first looks for an unzipped release folder with the relevant name.</li><li>If the folder is not found the script looks for a zip archive with the same name plus the .zip extension.</li><li>If the zip file is found it is unzipped and the resulting folder is used.</li></ul></li></ul></td></tr><tr><td><strong>Database name</strong></td><td>Leave blank to accept the default<br></td><td><p><strong>Default option</strong></p><ul><li>Uses the database name <strong>snomedct</strong>.</li><li>If the snomedct database already exists, it will be dropped (deleted) and recreated.</li></ul></td></tr><tr><td><strong>Database name</strong></td><td>Specify a name (must begin with the letter <strong>s</strong> followed by lowercase letters and/or digits)</td><td><p>Uses the database name provided.</p><ul><li>Using different names allows several SNOMED CT databases to co-exist (e.g. for different Editions)</li><li>Each SNOMED CT database will use about 5Gb of disk space ... so using different names may fill your available disk space!</li><li>If the named database already exists, it will be dropped (deleted) and recreated.</li></ul></td></tr><tr><td><strong>MySQL username</strong></td><td>Leave blank to accept the default</td><td>The default is <strong>root</strong>.</td></tr><tr><td></td><td>Enter your MySQL username</td><td>The username chosen must be an account with administrator access rights enabling database creation.</td></tr></tbody></table>

#### Wait for the Database Password Prompt <a href="#a.3.3loadreleasepackageintomysql-macos-waitforthedatabasepasswordprompt" id="a.3.3loadreleasepackageintomysql-macos-waitforthedatabasepasswordprompt"></a>

Before the creating the database the script generates an additional release file containing the transitive closure (this is used to optimize testing and listing of subtypes). This may take between 2 and 5 minutes to complete.

* If you rerun the loader script again on the same release, the script will reuse the existing transitive closure. If you accept the options, there will be no delay while the rebuild occurs.

#### Respond to the Database Password Prompt <a href="#a.3.3loadreleasepackageintomysql-macos-respondtothedatabasepasswordprompt" id="a.3.3loadreleasepackageintomysql-macos-respondtothedatabasepasswordprompt"></a>

When the script starts to access MySQL you will then be prompted for your database password.

* Note that the required password here is the password associated with your MySQL account.
* As noted earlier the account used for the SNOMED CT load process must have appropriate access permissions and its username should match your Mac login name.

### Wait for the Load Process to Complete <a href="#a.3.3loadreleasepackageintomysql-macos-waitfortheloadprocesstocomplete" id="a.3.3loadreleasepackageintomysql-macos-waitfortheloadprocesstocomplete"></a>

* Depending on system performance the process may take between 20 and 45 minutes to complete. It may take longer with National Editions that contain additional content.
  * As the MySQL script runs it will report progress on the screen. Some steps take much longer than others. For example, loading data into the database tables and adding or building indexes take much longer than any of the other steps. So if the message about these steps are showing for a long time don't worry. Let the process continue.
* When the script completes, scroll back up the command window to check for any ERROR reports for MySQL ... there should not be any!
* Now it is time to open MySQL Workbench to view your SNOMED CT database.

<a href="https://docs.google.com/forms/d/e/1FAIpQLScTmbZIf0UEQwYDkY27EEWBkaiYkHSbR0_9DmFrMLXoQLyL7Q/viewform?usp=pp_url&#x26;entry.1767247133=SQL+Guide&#x26;entry.670899847=A.3%20Instructions%20for%20Mac%20OS%20Users" class="button primary">Provide Feedback</a>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.snomed.org/snomed-ct-practical-guides/snomed-ct-sql-practical-guide/appendices/appendix-a-building-the-snomed-ct-example-database/a3-instructions-for-mac-os-users.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
