Kevin C. Wong

Install Wiki.js on macOS

Wiki.js installation instructions:

https://docs.requarks.io/install

Synthesizing those pages, these are the steps I used to install on macOS 12 (Monterey) and 13 (Ventura). We use postgres v15 because Wiki.js v3 will require postgres.

========================
install homebrew
========================

https://brew.sh

in Terminal: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

========================
install postgres db
========================

We install the lastest postgres supported by homebrew

in Terminal: brew install postgresql@15

For this install homebrew doesn't add links in /user/local/bin. Add postgres bin directory to path.

in Terminal: echo 'export PATH="/usr/local/opt/postgresql@15/bin:$PATH"' >> ~/.zshrc
in Terminal: source ~/.zshrc

By default postgres runs on localhost:5432, there is a postgres schema with an admin user (no password) same as your local user.

========================
install pgadmin4
========================

in Terminal: brew install --cask pgadmin4

This installs the macOS app pgAdmin 4 in the Applications folder.

Start pgAdmin 4 and add a connection to the local postgres at localhost:5432. Set admin user password.

You can use that user for Wiki.js or create a specific db user:

in Terminal: createuser -d -P wikijs

I found this user doesn't have enough privileges for Wiki.js (can't create tables). So I used pgAdmin 4 and set its privileges same as for my admin account. Also set the password.

========================
install node v16
========================

This is the latest version supported by Wiki.js.

in Terminal: brew install node@16

As for postgres we need to add node bin to path.

in Terminal: echo 'export PATH="/usr/local/opt/node@16/bin:$PATH"' >> ~/.zshrc
in Terminal: source ~/.zshrc

========================
install Wiki.js
========================

Specific macOS instructions:

https://docs.requarks.io/install/macos

The first step uses wget which you need to install.

----------------
install wget
----------------

in Terminal: brew install wget

----------------
install wiki.js
----------------

in Terminal: cd ~/Downloads ; wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz
in Terminal: mkdir -p /usr/local/wiki ; cd /usr/local/wiki ; tar xzf ~/Downloads/wiki-js.tar.gz -C .
in Terminal: cp config.sample.yml config.yml

Note that the tar doesn't include a config.yml file so updating is simply untar'ing the new tar.

edit config.yml
- it already uses postgres at localhost:5432 with user wikijs
- set password to wikijs password
- set db to postgres

start wiki.js, in Terminal: cd /usr/local/wiki ; node server

You can kill it with ctrl-c.

Now you can visit the site with your browser at http://localhost:3000

========================
Backups
========================

I found that Time Machine backs up everything fine including the postgres db.

If you backup directory /usr/local/var/postgresql@15 this will have the database and user accounts. On a new machine you can install postgres v15 then copy the backup to /usr/local/var/postgresql@15.

========================
TODO
========================

The above doesn't include ssl setup. You need a domain, dns server, and a web server. I guess I'll write this up in a future journal.