Uninstall Second Passenger on FreeBSD-11.1 - passenger

I have two Passenger installations from the sheer confusion with installations. So I'm given an error from some Passenger scripts:
You are currently validating against Phusion Passenger 5.3.4, located in:
/usr/local/lib/ruby/gems/2.5/gems/passenger-5.3.4/bin/passenger
Besides this Passenger installation, the following other
Passenger installations have also been detected:
/usr/local/bin/passenger
Please uninstall these other Passenger installations to avoid
confusion or conflicts.
I'm not sure how I installed the /usr/local/bin/passenger version, but I need to uninstall that one. pkg info reveals only rubygem-passenger-nginx-5.3.4 having Passenger mentioned.
Should I rename the latter instead of deleting? I want to be safe. As the warning states, it might create (more) confusion and some conflicts. Best way to turn this Passenger off? Cheers

Well, this is the FreeBSD world. Reference for FreeBSD-11.1-RELEASE
The solution is to not use a ruby package manager. No RVM, no rbenv. They're good for your workstation Mac/PC. Everything should be done through ports (/www/ports). Everything. Ruby, then normal gems including bundler first, and a proper Gemfile.
Ruby 2.5.1: cd /lang/ruby25 && sudo make install clean
gem install bundler
bundle install
Nginx: cd /www/nginx && sudo make install clean
Passenger: cd /www/rubygem-passenger && sudo make FLAVOR=nginx install clean
This latter FLAVOR is yet another layer of complexity to package managers. The default FLAVOR is Apache. This feature is less than a year old. Get to know it as I see multiple ports repackaged into a single port this way in the future.
Unfortunately this means dropping a lot of policies set forth before FreeBSD-11.1 with regards to the usual nginx-passenger-ruby stacks out there, but it's doable.

Related

Is it recomment to install ruby dependencies into local folder?

I'm learning ruby recently and I'm a front-end developer, I found the dependecies are installed to C:/Ruby31-x64/lib/ruby/gems/3.1.0 folder when I use bundle install. it seems dependencies are installed globally by default like the npm install -g. I know that Bundler also have a way to install the gems to the local folder, so I wonder is
it recommend to install the dependencies to the local folder like npm does?
Similar to Composer, Bundler takes care of maintaining your dependencies, but rather than installing everything in the project folder, it distributes your gems system-wide, which are then shared by all of your projects. Using the Gemfile in your project folder, it keeps track of which libraries each project needs. Bundler is the default package manager for Rails, so you should simply let it do its thing. It does it quite well.
Hope this helps.
Use a Version Manager for Ruby, and Bundler for Gem Version Management
There are occasionally reasons to install gems in from one another isolation, but most often you should use a Ruby version manager to manage your non-system Rubies and Bundler to handle multiple gem versions and locations. Avoid modifying your system Ruby or its gems whenever possible. Also, be aware that even using RVM gemsets (or similar features in other version managers) without tweaking some poorly documented features like rvm gemset globalcache enable can create a level of isolation that is likely unnecessary and can bloat disk usage dramatically.
If You Need Gem Isolation...
That said, if you want to ensure you are isolating your gems or localizing them to your application and aren't using direnv's Ruby layout to manage all the various environment variables involved, you can use Bundler's BUNDLE_PATH environment variable to "vendor" your gems into the local application directory (these days usually under vendor/bundle). For deployments or containerization, you can also invoke bundle-install with the --deployment or --standalone flags and a list of gem groups to install if you don't want to rely on the availability of Bundler itself after installing the gems.
This sort of thing might be useful for building containers or tarballs, but isn't really very useful for development. Don't do it unless you have a really strong reason.

how to use rbenv to manage local gems

I've been using Middleman since a while, but very recently it is getting some issues in loading.
This is likely due to the coexistence of very old gems of the same type.
Have to say that I did follow some online suggestions, but haven't really got the full understanding. So ended up using rbenv for managing ruby then bundle to install the gems.
Now, have two project that for which I need to "reset" and install only the referenced gems into the local folder or somehow they don't conflict.
I can't figure out how to do it.
Using the rbenv -local I can change the local ruby version, but not sure how to move next.
Any help?
Thanks
I don't think you need rbenv or rvm for this, although their are good tools. To run a piece of code with just the gems you need, and the versions you specified in your Gemfile, run any command prefixed with bundle exec.
For example bundle exec middleman server.

Install gems in parallel (faster)

Bundler has a feature where you can install gems in parallel using the --jobs option. For example:
bundle install --jobs 4
Does a similar feature exist for RubyGems?
I want to be able to run gem update in the same way.
The root problem is that it takes FOREVER to update my global system gems.
No, this feature does not currently exist. However, there’s an unmerged pull request on RubyGems regarding downloading gems in parallel that may be integrated by the time you read this: https://github.com/rubygems/rubygems/pull/649. However, this PR does not address the installation of gems in parallel like Bundler does. So, some of functionality might partially be coming soon.
That said, telling RubyGems to do fewer things during installation is a good way to speed up installation. There are three relevant CLI options worth looking at.
Don't install documentation:
gem update --no-document
Don't attempt to upgrade gems already meeting version requirement:
gem update --conservative
Don't upgrade any dependencies that already meet version requirements:
gem update --minimal-deps
I recommend simply installing gems without documentation. The intent behind running a global gem update is usually “just give me all the latest stuff” so limiting the gems you’re updating would be in conflict that goal. However, many people don’t look at the RDocs generated for their installed gems, and it saves a lot of installation time.
http://guides.rubygems.org/command-reference/#gem-update

Command Not Found Jekyll

I'm trying to create and publish a Jekyll blog using this template.
I installed Jekyll initially. Without any luck, I did resort to installing it via sudo. (And have now since uninstalled it!)
Jekyll(1.4.2, 1.0.3) and am running rvm with ruby 2.0.0p195. After installing the gem, I run jekyll serve in the folder but get the error: Zsh Command Not Found. I tried changing my path to no avail. Any advice on how to troubleshoot?
I cannot uninstall/reinstall nokogiri (see other SO articles on this) because of dependencies related to work projects.
If you're using rvm you should not install gems with sudo. Rvm is user-specific (the binaries are all in your home directory), so putting Ruby stuff in system-wide folders with sudo will not work. Just install without sudo and you should be ok.
The rvm docs tries to explain this a little bit here:
http://rvm.io/rubies/rubygems
DO NOT use sudo...
...to work with RVM gems. When you do sudo you are running commands as root, another user in another shell and hence all of the setup that RVM has done for you is ignored while the command runs under sudo (such things as GEM_HOME, etc...). So to reiterate, as soon as you 'sudo' you are running as the root system user which will clear out your environment as well as any files it creates are not able to be modified by your user and will result in strange things happening. (You will start to think that someone has a voodoo doll of your application...)

fubar'd a ruby installation on ubuntu, need helping purging it for reinstall

i originally followed these steps to get a RoR environmentgoing: https://help.ubuntu.com/community/RubyOnRails
that worked. then i put 1.9.2 on here. then i decided i want the original setup, did a "whereis ruby" and deleted those directories manually.
that fubar'd my ruby installation. i can't use the repository to what i originally had. how can i purge ruby from completely and start fresh?
right now the specific error is this:
/usr/lib/ruby/1.8/rubygems.rb:11:in `require': no such file to load -- thread (LoadError)
from /usr/lib/ruby/1.8/rubygems.rb:11
from /usr/bin/gem1.8:8:in `require'
from /usr/bin/gem1.8:8
tipu#tipu_ubuntu:~$
You're not giving enough real information to be specific, but this is what I'd try:
Use apt-search to locate Ruby 1.8.7 for your OS version.
Using apt-get, uninstall that version so you're back to what APT thinks is a clean slate.
Again using apt-get, reinstall that version so you're back to what APT thinks is a normal installation.
From that point, I would STOP messing with the system Ruby, and instead use RVM to manage and install any new Ruby and gems installations into RVM's ~/.rvm sandbox.
To follow up on the Tin Man's answer:
I wrote a guide to installing Ruby and Rails on Ubuntu which you may find useful for getting this all peachy again.
Hope it helps!
You need to reinstall libruby1.8. I'm pretty sure that will take care of it. I had exactly the same problem.

Resources