Beginners Guide to Install Discourse on Mac OS X (macOS) for Development


(Quang-Buu Le) #112

Discourse won’t work with imagemagick 7 that would come when we do brew install imagemagick.
We should install v6 instead.


(Joffrey Jaffeux) #113

good catch, I’ve sent a PR to @techAPJ : Make sure we install imagemagick 6 and not 7 by jjaffeux · Pull Request #5 · techAPJ/install-rails · GitHub


(Sam Saffron) #114

Note, we would love to upgrade to support 7 but it is a very hairy series of changes.


(Quang-Buu Le) #115

The tar utility that come with MacOS won’t work too, had to do brew install gnu-tar --with-default-names to be able to backup the discourse.


(Henrik Berg) #116

When I reach the Ruby portion of the Discourse dependencies script, it gives me this error. Anyone know how I could solve this?

 Installing Ruby 2.3.0 ...

rbenv: /Users/Henrik/.rbenv/versions/2.3.0 already exists
continue with installation? (y/N) y
ruby-build: use openssl from homebrew
Downloading ruby-2.3.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...
ruby-build: use readline from homebrew

BUILD FAILED (OS X 10.12.6 using ruby-build 20170726)

Inspect or clean up the working tree at /var/folders/zn/j1h6j_t52_q8xv20kfsmlsqh0000gn/T/ruby-build.20170902162015.54055
Results logged to /var/folders/zn/j1h6j_t52_q8xv20kfsmlsqh0000gn/T/ruby-build.20170902162015.54055.log

Last 10 log lines:
	from /private/var/folders/zn/j1h6j_t52_q8xv20kfsmlsqh0000gn/T/ruby-build.20170902162015.54055/ruby-2.3.0/lib/rubygems/specification.rb:742:in `each'
	from /private/var/folders/zn/j1h6j_t52_q8xv20kfsmlsqh0000gn/T/ruby-build.20170902162015.54055/ruby-2.3.0/lib/rubygems/specification.rb:742:in `block in each_gemspec'
	from /private/var/folders/zn/j1h6j_t52_q8xv20kfsmlsqh0000gn/T/ruby-build.20170902162015.54055/ruby-2.3.0/lib/rubygems/specification.rb:741:in `each'
	from /private/var/folders/zn/j1h6j_t52_q8xv20kfsmlsqh0000gn/T/ruby-build.20170902162015.54055/ruby-2.3.0/lib/rubygems/specification.rb:741:in `each_gemspec'
	from /private/var/folders/zn/j1h6j_t52_q8xv20kfsmlsqh0000gn/T/ruby-build.20170902162015.54055/ruby-2.3.0/lib/rubygems/specification.rb:819:in `each_spec'
	from ./tool/rbinstall.rb:751:in `block in <main>'
	from ./tool/rbinstall.rb:801:in `block in <main>'
	from ./tool/rbinstall.rb:798:in `each'
	from ./tool/rbinstall.rb:798:in `<main>'
make: *** [do-install-all] Error 1
failed

(Henrik Berg) #117

Still experiencing the above issue. Is there anyone that could point me in the right direction? Wanted to try out something on Discourse, but haven’t been able to because of this.


(Arpit Jalan) #118

Hi Henrik,

This issue seems to be because Ruby 2.3.0 was already installed on your system via rbenv.

I updated the script to use Ruby 2.3.4, can you try running the script again?


If you can install Docker on your macOS, I also recommend trying our Docker Dev image:


(Henrik Berg) #119

I reran the script, and it works! I had also tried using Docker, and it’s a much easier and streamlined process. My Discourse is up and running.

Thank you for your help!


(Dennis Pipper) #120

What if after all this and I want to remove this entire install from my server? Is that possible?


(Kris) #121

FYI in case anyone runs into this; the script in this guide currently installs postgres 10, which Discourse doesn’t yet support

I manually installed 9.6 for the time being


(Benjamin Borowski) #122

Ran into some warnings during the initial rake tasks:

/gems/ruby-2.4.1@discourse/gems/i18n-0.8.6/lib/i18n.rb:12: warning: already initialized constant I18n::RESERVED_KEYS
/Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/i18n-0.8.6/lib/i18n.rb:12: warning: previous definition of RESERVED_KEYS was here
/Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/i18n-0.8.6/lib/i18n.rb:13: warning: already initialized constant I18n::RESERVED_KEYS_PATTERN
/Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/i18n-0.8.6/lib/i18n.rb:13: warning: previous definition of RESERVED_KEYS_PATTERN was here

Any idea what I did incorrectly?


(Jay Pfaffman) #123

Nothing. I think it’s part of the Rails 5 upgrade. You can ignore it until someone fixes it. That’s what I’ve been doing.


(Benjamin Borowski) #124

Looks like the guide needs to be updated to include the creation and configuration of discourse_test_multisite. Anyone got notes on that? Same as _development and _test?

        ActiveRecord::NoDatabaseError:
          FATAL:  database "discourse_test_multisite" does not exist

(Benjamin Borowski) #125

Also appears to be missing from install script:

brew link --force imagemagick@6

(Arpit Jalan) #126

Feel free to send a PR! install-rails/mac at master · techAPJ/install-rails · GitHub


(Benjamin Borowski) #127

done, thanks for the script. wasn’t sure if linking for everyone would make sense.


(Benjamin Borowski) #128

Getting this on boot on a new install on Mac…

11:23:29 web.1    | => Run `rails server -h` for more startup options
11:23:29 web.1    |         ** ERROR: directory is already being watched! **
11:23:29 web.1    |
11:23:29 web.1    |         Directory: /Users/typeoneerror/Dev/discourse/plugins/discourse-narrative-bot/public/public
11:23:29 web.1    |
11:23:29 web.1    |         is already being watched through: /Users/typeoneerror/Dev/discourse/plugins/discourse-narrative-bot/public
11:23:29 web.1    |
11:23:29 web.1    |         MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors

Seems to be creating an infinite symlink in that plugin folder…

Not sure what I did. When I run server it sometimes creates that symlink. After deleting it and restarting I got:

11:32:45 web.1    | /Users/typeoneerror/Dev/discourse/lib/discourse.rb:27:in `execute_command': ln: /Users/typeoneerror/Dev/discourse/public/plugins/discourse-narrative-bot: File exists (RuntimeError)
11:32:45 web.1    | 	from /Users/typeoneerror/Dev/discourse/lib/plugin/instance.rb:445:in `activate!'
11:32:45 web.1    | 	from /Users/typeoneerror/Dev/discourse/lib/discourse.rb:146:in `block in activate_plugins!'
11:32:45 web.1    | 	from /Users/typeoneerror/Dev/discourse/lib/discourse.rb:143:in `each'
11:32:45 web.1    | 	from /Users/typeoneerror/Dev/discourse/lib/discourse.rb:143:in `activate_plugins!'
11:32:45 web.1    | 	from /Users/typeoneerror/Dev/discourse/config/application.rb:178:in `<class:Application>'
11:32:45 web.1    | 	from /Users/typeoneerror/Dev/discourse/config/application.rb:26:in `<module:Discourse>'
11:32:45 web.1    | 	from /Users/typeoneerror/Dev/discourse/config/application.rb:25:in `<main>'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `block in perform'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<main>'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
11:32:45 web.1    | 	from /Users/typeoneerror/.rvm/gems/ruby-2.4.1@discourse/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
11:32:45 web.1    | 	from bin/rails:4:in `<main>'

Then I just deleted the entire discourse-narrative-bot plugin and git checkout and it works again. Will update here if I find out which action I’m taking causes that symlink to be generated.


(James Brown) #129

Whenever i run this command bundle exec rake db:migrate db:test:prepare db:seed_fu. it gives me this response: Could not find nokogiri-1.8.1 in any of the sources
Run bundle install to install missing gems. I have done the bundle install so i don’t know whats wrong. help appreciated.


(Jay Pfaffman) #130

Did bundle install succeed?

You might try

gem install nokogiri -v '1.8.1'
bundle install

I had a similar problem that was due to my having installed ruby via my OS’s (Ubuntu) version of Ruby. As a result, some commands would use the correct version of ruby and others would use the OS version, so things that one version thought were installed proved not to be installed for the other.

If you have an Apple ruby and a brew ruby, that could be the problem. (I don’t really use Mac, so the particulars of this are likely wrong).


(James Brown) #131

Yes the bundle install succeeded. I tried your command but the same error occured.
Edit:
@pfaffman This error still occurs when doing bundle exec rake db:migrate db:test:prepare db:seed_fu it comes up with this error: An error occurred while installing nokogiri (1.8.1), and Bundler cannot
continue.
Make sure that gem install nokogiri -v '1.8.1' succeeds before bundling.