Help with dev setup for project site

I’ve been having another go at repairing my dev setup for the project site so that I can do some tutorial updates. I find that each time I come back to it after a break of a few weeks, it is broken again. (Using Mac OS 10.13.6).

I think there might be a PATH issue. If that is likely, scroll down to where I discuss this.

What happened just now:

On opening the command line (Terminal), the warning Required ruby-2.5.1 is not installed. is shown. The installation guide on the project site repo states to use Ruby 2.3. Attempting to install 2.3 produced the following error at various stages in the process:


xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

and ended with


Error: Failure while executing; `git config --local --replace-all homebrew.analyticsmessage true` exited with 1.

Does that mean that XCode Command Line Tools needs to be reinstalled? Or do I need to (re)set a path for it?

I stuck with the installed Ruby 2.4.0, updated Bundler to 1.16.6 and then tried the next step, bundle install --with mysql. First I got an advice alert, which would be nice to resolve for the future:


The git source `git://github.com/feedjira/feedjira.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.

Bundling was fine with gems already up to date until it reached nokogiri:


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:

/Users/[me]/.rvm/gems/ruby-2.4.0/gems/nokogiri-1.8.4/ext/nokogiri

/Users/[me]/.rvm/rubies/ruby-2.4.0/bin/ruby -r ./siteconf20181021-4414-b31nlj.rb

extconf.rb

checking if the C compiler accepts ... *** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of necessary

libraries and/or headers. Check the mkmf.log file for more details. You may

need configuration options.

The full log, in /.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-16/2.4.0/nokogiri-1.8.4/mkmf.log, reads:


"gcc -o conftest -I/Users/[me]/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/x86_64-darwin16 -I/Users/[me]/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/backward -I/Users/[me]/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/[me]/.rvm/rubies/ruby-2.4.0/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib -lruby.2.4.0 -lpthread -ldl -lobjc "

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

checked program was:

/* begin */

1: #include "ruby.h"

2:

3: int main(int argc, char **argv)

4: {

5: return 0;

6: }

/* end */

PATH issues?

I think that one reason for the repeated problems I have might be that PATH is improperly set. I find, for instance, that duplicate gems appear in different folders (more for the main diaspora setup than for the project site). And I occasionally get warnings such as

> Warning! PATH is not properly set up, /Users/[me]/.rvm/gems/ruby-2.4.0/bin is not at first place.

I have the following possibly relevant files in my root user folder with contents as shown:

  • .bash_profile

source ~/.profile

# Added by install_latest_perl_osx.pl

[ -r /Users/[me]/.bashrc ] && source /Users/[me]/.bashrc

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

  • .barshrc

PATH=$PATH:/Users/[me]/.rvm/gems/ruby-2.3.3/bin

source /Users/[me]/perl5/perlbrew/etc/bashrc

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

export PATH="$PATH:$HOME/.rvm/bin"

  • .profile

# MacPorts Installer addition on 2012-09-26_at_17:37:59: adding an appropriate PATH variable for use with MacPorts.

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

export PATH=/usr/local/bin:$PATH

# Finished adapting your PATH environment variable for use with MacPorts.

PATH=$PATH:$HOME/.rvm/gems/ruby-2.3.1/bin

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

export PATH="$PATH:$HOME/.rvm/bin"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

  • .mkshrc

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

export PATH="$PATH:$HOME/.rvm/bin"

  • .zlogin

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

  • .zshrc

PATH=$PATH:$HOME/.rvm/gems/ruby-2.3.1/bin

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

export PATH="$PATH:$HOME/.rvm/bin"

If there are some issues with the setup evident from those files, it might be easiest to uninstall everything and set the PATH properly and start again. What would be the safest way to do this? I did try to do this for the main diaspora setup earlier this year, as far as uninstalling homebrew itself, and reinstalling everything, but that still didn’t produce a working installation. I fear there might be bits and pieces left over from an earlier installation that should have been removed during an update but weren’t because of the PATH issue.

If you could advise on this issue first, or tell me what further info you need, that would be fantastic.

Maybe you want to try the dev setup I created? It should work now on MacOS, however it’s not merged yet. Have more people work with it might speed that up.

How does your PATH look like? I can’t seem to find it, if you posted it already.

Thanks for replying.

There are several lines in the files I pasted which seem to me to be setting the PATH. Is that not what they do?

I’ll probably do that next time I want to work on diaspora itself. But this request is for setup for working on the project site, which has different requirements. Even if it would work, installing the complete setup for diaspora would certainly be overkill for this!

I have no idea about Mac OS, so I probably can’t help much, but here are some hints.

@denschub upgraded it to ruby 2.5 some time ago without updating the readme. it probably still runs with 2.3, but it tries to select 2.5 automatically (the version in the .ruby-version file), which is why you see the error message about 2.5.1 is not found.

I don’t know why you selected 2.4 now, because I would always recommend to use the version in the .ruby-version file, if there isn’t a reason against it.

It looks like some gems don’t compile, but that’s the point where I can’t help further, because I have no idea how this should work under Mac OS.

At least from what I can see, everything looks OK with the PATH. Why do you think you have a path issue? It’s more a problem that probably some dependencies are missing which are required to compile the gems.

2.4 was the version I used when I last successfully ran the setup, so it was already installed and selected, and I was unable to install either 2.3 (as per the readme) or 2.5 (as per the command-line warning). I thought I’d see how far I could get.

I’ll come back to your other comments tomorrow. Thanks, both of you.

To see the actual resulting PATH, do an echo $PATH. If you don’t mind pasting it here, that might help as well if it is a PATH issue.

I don’t know why you selected 2.4 now, because I would always recommend to use the version in the .ruby-version file, if there isn’t a reason against it.

I am using 2.4 within RVM because that’s what the install guide says to use. I didn’t realize we bumped up versions. At least that’s what the Ubuntu 16.04 version says (link). PS I’ve been following the instructions for 16.04 on 18.04-based distros (Linux Mint 19) and it has worked flawlessly with the exception of the Postgres version is one ahead.

Goob is talking about the project-site, not diaspora itself. Diaspora still has support for 2.3 and 2.4, where 2.4 is the default. For the project-site the default was changed to 2.5 already (and I think it also runs with 2.5 in production).

1 Like

$ echo $PATH

/Users/[me]/perl5/perlbrew/bin:/Users/[me]/perl5/perlbrew/perls/perl-5.16.0/bin:/Users/[me]/.rvm/gems/ruby-2.4.0/bin:/Users/[me]/.rvm/gems/ruby-2.4.0@global/bin:/Users/[me]/.rvm/rubies/ruby-2.4.0/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/Users/[me]/.rvm/gems/ruby-2.3.1/bin:/Users/[me]/.rvm/bin:/Users/[me]/.rvm/gems/ruby-2.3.3/bin:/Users/[me]/.rvm/bin

Any use?

Your PATH setup differs a bit from mine.

All I have added to .bashrc, .profile and .zshrc at the bottom is

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

From what it looks like, this should be sufficient.

If I were you, I’d remove (or comment)

and

and

I don’t think they are necessary. Also, I’d put the lines I quoted from my files instead of any custom RVM-related changes to the PATH variable. This should, if nothing else, make your PATH a standard setup for RVM.

This is what I would try, and no guarantees :wink:

Edit: Just to be safe: Make backup copies.

No way – I live on the edge!

I made the PATH changes you suggested, but still got the ‘incorrect PATH’ warning. I tried repairing in RVM and deleting rubies and gemsets, but all were failing. In the end I removed absolutely everything from my disc and reinstalled from the ground up. It’s now working, and with the PATH changes hopefully it won’t break again!

Thanks, everyone.

1 Like

Sorry, I’m late to the party. Kudos for reinstalling everything just to get diaspora stuff working.

Anyway, your issue likely was a ruby installed via MacPorts. MacPorts is evil, and should be avoided at all cost. I suggest brew for all your packaging needs. But still, if you have set up rvm, I suggest you to not install Ruby via MacPorts/brew, as that will make things more difficult to manage.

Glad it’s working now. And thanks for reminding me the project site really needs a more helpful readme.

1 Like

I think I installed, and later removed, MacPorts before I ever started to contribute to d*. It’s noted as conflicting with Homebrew so I most likely removed it when I first installed brew as I was no longer using it. (I also dabbled in fink years ago; I think both were related to something I was trying to do with audio.) And I’m pretty sure I’ve always installed Ruby via RVM. Not sure how those errant PATH lines to specific rubies appeared in the .bashrc and other files; I can imagine that I entered them manually a while ago to try kickstarting the setup and misunderstanding one instruction or another…

The thing is, when it works, it works so well that it all seems simple. And then when something doesn’t work, it’s intensely complex!

mhm. Let’s debug the next time you run into issues - which hopefully is never. :slight_smile:

1 Like