Installation/Mac OS/High Sierra: Difference between revisions

From diaspora* project wiki
m (→‎Set arch to 64: replace closing quote mark with straight quote mark)
(→‎Git: on OSX 10.14m(Mojave) libidn must be installed first to install idn-ruby gem)
 
Line 43: Line 43:
=== Git ===
=== Git ===


To install Git, run the following:
Is is already installed with xcode
 
<pre>brew install git</pre>


=== Pronto (Only for development) ===
=== Pronto (Only for development) ===
Line 80: Line 78:


<pre>sudo gem install bundler</pre>
<pre>sudo gem install bundler</pre>
Install libidn or idn-ruby gem installation will fail:
<pre> brew install libidn</pre>


Now, follow the standard Installation instructions with the following very important changes [[Installation/Backport#Get_the_source|Notes On Installing and Running Diaspora]]
Now, follow the standard Installation instructions with the following very important changes [[Installation/Backport#Get_the_source|Notes On Installing and Running Diaspora]]

Latest revision as of 16:07, 27 October 2018

NoteNote: This guide only describes the important differences from the standard installation, full step by step guide to follow

Versions

These instructions are for Mac OS X 10.13.3 (High Sierra)

Package Management

Install Homebrew and then come back here.

Build Tools

Run:

xcode-select --install

or go to link below and download command line tools if above does not work:

xcode command line tools

MySQL

To install MySQL, run the following:

brew install mysql

Add it to launchctl so it will start automatically:

ln -sfv /usr/local/opt/mysql/*.plist /Library/LaunchDaemons
mysql.server start

Now mysql is running, and you have a user named root with no password.

ImageMagick

To install ImageMagick, run the following:

brew install imagemagick --with-freetype --with-fontconfig

Make sure to add freetype and fontconfig switches, as they are needed for image captcha

Git

Is is already installed with xcode

Pronto (Only for development)

The Rugged gem which is a dependency for Pronto, requires cmake:

brew install cmake

Redis

To install Redis, run the following:

brew install redis

Start redis:

$ redis-server /usr/local/etc/redis.conf

Add to launchctl to start automatically:

$ sudo cp /usr/local/Cellar/redis/4.0.8/homebrew.mxcl.redis.plist /Library/LaunchDaemons

or

$ sudo ln -sn /usr/local/Cellar/redis/4.0.8/homebrew.mxcl.redis.plist /Library/LaunchDaemons

RubyGems

RubyGems comes preinstalled. However, you might need to update it for use with the latest Bundler. To update RubyGems, run

sudo gem update --system

Bundler

To install Bundler, run the following:

sudo gem install bundler

Install libidn or idn-ruby gem installation will fail:

 brew install libidn


Now, follow the standard Installation instructions with the following very important changes Notes On Installing and Running Diaspora

Changes to the standard installation instructions

Fix nproc in script/configure_bundler

Mac OS X doesn't have nproc, so in script/configure_bundler replace it with sysctl -n hw.ncpu

replace
config("jobs #{`nproc`}")
with
config("jobs #{`sysctl -n hw.ncpu`}")

Set arch to 64

VERY IMPORATANT to set arch to 64 bit before you run the installation or the bundler will look for 32 bit libraries and fail

$ export ARCHFLAGS="-arch x86_64"
$ bin/bundle install --full-index

Fix config/eye.rb

Final point, unicorn fails to start with -D. Update config/eye.rb

#      start_command "#{unicorn_command} -D"
#      daemonize false
      start_command unicorn_command
      daemonize true

start diaspora

 $ ./script/server

Alternative start

You can use those plist to run it automatically. Note that web uses unix socket to communicate. If you changed config/diaspora.yml configuration.server.listen to something other than the default, you have to update "Sockets" settings below.

/System/Library/LaunchDaemons/com.diaspora.web.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.diaspora.web</string>
    <key>UserName</key>
    <string>diaspora</string>
    <key>WorkingDirectory</key>
    <string>/Users/diaspora/diaspora</string>
    <key>EnvironmentVariables</key>
    <dict>
            <key>RAILS_ENV</key>
            <string>production</string>
    </dict>
    <key>Sockets</key>
    <dict>
        <key>Listener</key>
        <dict>
            <key>SockPathMode</key>
            <integer>0777</integer>
            <key>SockPathName</key>
            <string>tmp/diaspora.sock</string>
        </dict>
    </dict>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>-lc</string>
        <string>bin/bundle exec unicorn -c config/unicorn.rb -E production</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
</dict>
</plist>


/System/Library/LaunchDaemons/com.diaspora.sidekiq.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.diaspora.sidekiq</string>
    <key>UserName</key>
    <string>diaspora</string>
    <key>WorkingDirectory</key>
    <string>/Users/diaspora/diaspora</string>
    <key>EnvironmentVariables</key>
    <dict>
            <key>RAILS_ENV</key>
            <string>production</string>
    </dict>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>-lc</string>
        <string>bin/bundle exec sidekiq</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
</dict>
</plist>


Congratulations!