×
Back to book

SpringBot: Setting Up Your Development Environment: Mac

Setup instructions for setting up your local SpringBot development environment for Mac

The following steps will walk you through the process of setting up your development environment.

This lesson assumes you are running mac OS Mojave.

Approximate setup time is 30-40 minutes.

Downloads

These are all the download links provided in this article. If you have a slow internet connection you may wish to begin downloading all items first to save time.

Java, Nodejs, Gradle, PostgreSQL, pgAdmin 4

Java

Any versions of java above 11 should work, however SpringBot has been built and tested with Java 11, as it is the latest version with long term support (LTS). This tutorial will use adoptOpenJDK 11 because it is open source and free for commercial use.

  1. Download an installer for adoptOpenJDK11 here:
    https://adoptopenjdk.net/index.html?variant=openjdk11&jvmVariant=hotspot
    Once the pkg file has finished downloading, double click to open and follow the installation wizard process.
  2. Open a new terminal and check the Java version is correct:

java -version

If this does not work, you may have to update PATH to point to your latest Java installation.

Node and Angular

  1. Install Node. Download version 8 for macOS (file ending in .pkg) using the direct download link or from the Node website.
    Open the installer and run through the setup.

  2. When this is complete open a new terminal and run node -v which should output something like v8.10.0 depending on the version you downloaded.

  3. (Optional) Install Angular CLI globally. This step is not strictly necessary, but provides ease of use. If you omit this step, all Angular CLI commands can be achieved by invoking the local version by prefixing all commands with npx . i.e ng serve would become npx ng serve.

    To install, copy and paste the following into your terminal and press enter:

    npm install -g @angular/cli@7.3.1

    Note: Please contact us if you have any issues installing Angular globally.

  4. After this has finished, running ng version should provide the following output:

Gradle

  1. Download the complete version of Gradle version 5.2.1 from the direct download link, or from the Gradle website

  2. Run the following commands to unzip the downloaded file

Note we are using the /opt/gradle directory, but you can choose to put it wherever you like as long as you replace the /opt path used in this article.

sudo mkdir /opt
sudo mkdir /opt/gradle

Open a new terminal by pressing (CMD + N) and navigate to Downloads

cd Downloads

Then run the following commands.

Note that your downloaded file may be named slightly differently. If so you will need to replace gradle-5.2.1-all.zip with what it is named in your downloads

sudo unzip -d /opt/gradle gradle-5.2.1-all.zip
ls /opt/gradle/gradle-5.2.1

Now you should see the following files:

LICENSE  NOTICE  bin  getting-started.html  init.d  lib  media
  1. You will now need to add Gradle to your PATH by running the command below
echo 'export PATH=$PATH:/opt/gradle/gradle-5.2.1/bin' >> ~/.bash_profile

To test that this has worked correctly, open a new terminal (CMD +N)
and run the following command:

echo $PATH

And you should see a line finishing with our new gradle directory:

/usr/local/bin://usr/bin:/bin:/usr/sbin:/sbin:/opt/gradle/gradle-5.2.1/bin

PostgreSQL

postgreSQL is the database of choice for Springbot applications. This section will explain how to install and run it.

  1. Download the package installer v11.5 for mac from the Direct Download Link

Or alternatively from the website


  1. Open the downloaded dmg

  1. If prompted, click open

  1. Enter your username and password

  1. Continue through the installer with the default settings:

  1. Enter bots as a password. You may use your own however this article assumes in future steps that you have set it to 'bots'

  2. Leave the port set to it's default of 5432

  3. Keep the [Default locale] selection

  4. Ensure that the settings for the installation match

  5. Continue and wait for the installation to complete

  1. Untick "launch stack builder" and click finish

  1. install pgAdmin
    pgAdmin is a useful database explorer that works with postgreSQL.
    You can download the latest version from the Direct Download Link

Or alternatively you can download from the website


  1. pgAdmin will open in your browser and request you set a master password.

You can set this to be anything as long as you remember it. We use the password 'bots' in these examples.

Create databases and roles

From here you can either use pgAdmin or the command line to create and manage your databases but this guide will use pgAdmin to interface with the database.

If you aren't connected already, connect to the Postgres server using the password defined in the PostgreSQL install command above (bots).

  1. Right click on the local PostgreSQL server and select 'Connect Server':

  2. Enter the password and press "OK"

We now need to create a new user and database in Postgres to allow Codebots target application to interact with.

  1. Create a new "Login/Group Role". Right click on the "PostgreSQL" server and select "Create" > "Login/Group Role...":

  2. Under the "General" tab, enter the "Name" codebots"

  3. Click the "Definition" tab and enter the "Password" bots:

  4. Click the "Privileges" tab and set the "Superuser?" toggle to "Yes":

  5. Click "Save" to create the new Role.

Now to create the new database:

  1. Right click on "Databases" and select "Create" > "Database...":

  2. Under the "General" tab, enter the "Database" codebots" and select the "Owner" codebots:

  3. Click the "Definition" tab and select the "Encoding" UTF8 and "Template" template0:

  4. Click "Save" to create the new Database.

If everything was executed properly you would have successful create database and user called codebots, like the image below.


This completes the server setup required to run your SpringBot application! You should now complete the lesson on how to setup your local development environment to start editing your SpringBot application. Then run your application on your SpringBot server!