Rubygems Issues For Mac
With package managers or third-party tools, you have plenty of optionsto install and manage Ruby.
- How To Install And Run Ruby On Mac OS X - Dummies
- Rubygems Issues For Mac Os
- Questions / Discussion Area - RubyGems.org Support
redmine@mail rubygems-2.6.12$ ruby -v ruby 2.4.1p111 (2017-03-22 revision 58053) x8664-linux redmine@mail rubygems-2.6.12$ which ruby /usr/sbin/ruby. If you try rails new foo to build a new Rails application with RubyGems 1.8.23 and Ruby 1.9.3-p194 you'll get an error because RubyGems now verifies SSL certificates and Bundler tries to connect with when you build a new Rails app and is wrongly configured for SSL connections. RubyGems, the Ruby package manager, should be installed on your machine if you previously have installed Ruby. Verify this by running: which gem Update RubyGems. To update to its latest version with: gem update -system Install gems. To install a gem (Ruby package), run: gem install. Ruby -ropenssl -e 'p OpenSSL::OPENSSLVERSION' 'OpenSSL 0.9.8y 5 Feb 2013' openssl sclient -showcerts -connect rubygems.org:https CONNECTED(00000003) depth=1 C = US, O = 'GeoTrust, Inc.' , CN = RapidSSL CA verify error:num=20:unable to get local issuer certificate verify return:0 - Certificate chain 0 s:/serialNumber.
You may already have Ruby installed on your computer. You can checkinside a terminal emulator by typing:
This should output some information on the installed Ruby version.
Choose Your Installation Method
There are several ways to install Ruby:
- On a UNIX-like operating system, using your system’spackage manager is easiest.However, the packaged Ruby version may not be the newest one.
- Installers can be used to install a specific or multipleRuby versions. There is also an installer for Windows.
- Managers help you to switch between multiple Ruby versionson your system.
- Finally, you can also build Ruby from source.
On Windows 10, you can also use the Windows Subsystem for Linuxto install one of the supported Linux distributions and use any of theinstallation methods available on that system.
Here are available installation methods:
- Package Management Systems
- Installers
- RubyInstaller (Windows)
- Managers
Package Management Systems
If you cannot compile your own Ruby, and you do not want to use athird-party tool, you can use your system’s package manager to install Ruby.
Some members of the Ruby community feel that you should avoid packagemanagers to install Ruby and that you should use dedicated tools instead.
It is possible that major package managers will install older Rubyversions instead of the latest release. To use the latest Ruby release,check that the package name matches its version number. Or use adedicated installer.
apt (Debian or Ubuntu)
Debian GNU/Linux and Ubuntu use the apt package manager. You can use itlike this:
yum (CentOS, Fedora, or RHEL)
CentOS, Fedora, and RHEL use the yum package manager.You can use it like this:
The installed version is typically the latest version of Ruby availableat the release time of the specific distribution version.
snap (Ubuntu or other Linux distributions)
Snap is a package manager developed by Canonical.It is available out-of-the-box on Ubuntu, but snap also workson many other Linux distributions.You can use it like this:
We have several channels per Ruby minor series.For instance, the following commands switch to Ruby 2.3:
portage (Gentoo)
Gentoo uses the portage package manager.
To install a specific version, set RUBY_TARGETS
in your make.conf
.See the Gentoo Ruby Project website for details.
pacman (Arch Linux)
Arch Linux uses a package manager named pacman.To get Ruby, just do this:
This should install the latest stable Ruby version.
Homebrew (macOS)
Ruby versions 2.0 and above are included by default in macOS releasessince at least El Capitan (10.11).
Homebrew is a commonly used package manager on macOS.Installing Ruby using Homebrew is easy:
This should install the latest Ruby version.
FreeBSD
FreeBSD offers both pre-packaged and source-based methods to install Ruby.Prebuilt packages can be installed via the pkg tool:
A source-based method can be used to install Ruby using thePorts Collection. This is useful if you wantto customize the build configuration options.
More information about Ruby and its surrounding ecosystem on FreeBSDcan be found on the FreeBSD Ruby Project website.
OpenBSD
OpenBSD as well as its distribution adJ has packages for the threemajor versions of Ruby. The following command allows you to see theavailable versions and to install one:
You can install multiple major versions side by side, because theirbinaries have different names (e.g. ruby27
, ruby26
).
The HEAD
branch of the OpenBSD ports collection might have themost recent version of Ruby for this platform some days after itis released, seedirectory lang/ruby in the most recent ports collection.
Ruby on OpenIndiana
To install Ruby on OpenIndiana, please use theImage Packaging System (IPS) client.This will install the Ruby binaries and RubyGems directlyfrom the OpenIndiana repositories. It’s easy:
However, the third-party tools might be a good way to obtain thelatest version of Ruby.
Other Distributions
On other systems, you can search the package repository of your Linuxdistribution’s manager for Ruby. Alternatively, you can use athird-party installer.
Installers
If the version of Ruby provided by your system or package manager is outof date, a newer one can be installed using a third-party installer.
Some installers allow you to install multiple versions on the samesystem; associated managers can help to switch between the differentRubies.
If you are planning to use RVM as a version manager you don’tneed a separate installer, it comes with its own.
ruby-build
ruby-build is a plugin for rbenv that allows youto compile and install different versions of Ruby. ruby-build can alsobe used as a standalone program without rbenv. It is available for macOS,Linux, and other UNIX-like operating systems.
ruby-install
ruby-install allows you to compile and install differentversions of Ruby into arbitrary directories. chruby is acomplimentary tool used to switch between Ruby versions. It is availablefor macOS, Linux, and other UNIX-like operating systems.
RubyInstaller
On Windows, RubyInstaller gives you everything you needto set up a full Ruby development environment.
Just download it, run it, and you are done!
Ruby Stack
If you are installing Ruby in order to use Ruby on Rails,you can use the following installer:
- Bitnami Ruby Stack provides a complete developmentenvironment for Rails. It supports macOS, Linux, Windows, virtualmachines, and cloud images.
Managers
Many Rubyists use Ruby managers to manage multiple Rubies. They alloweasy or even automatic switching between Ruby versions depending on theproject and other advantages but are not officially supported. You canhowever find support within their respective communities.
asdf-vm
asdf-vm is an extendable version manager that can manage multiplelanguage runtime versions on a per-project basis. You will need theasdf-ruby plugin (which in turn uses ruby-build)to install Ruby.
chruby
chruby allows you to switch between multiple Rubies. It canmanage Rubies installed by ruby-install or even builtfrom source.
rbenv
rbenv allows you to manage multiple installations of Ruby.While it can’t install Ruby by default, its ruby-buildplugin can. Both tools are available for macOS, Linux, or otherUNIX-like operating systems.
RVM (“Ruby Version Manager”)
RVM allows you to install and manage multiple installations ofRuby on your system. It can also manage different gemsets. It isavailable for macOS, Linux, or other UNIX-like operating systems.
uru
Uru is a lightweight, multi-platform command line tool that helps youto use multiple Rubies on macOS, Linux, or Windows systems.
Building from Source
Of course, you can install Ruby from source.Download and unpack a tarball, then just do this:
By default, this will install Ruby into /usr/local
.To change, pass the --prefix=DIR
option to the ./configure
Java 8 update 101 64 bit. script.
You can find more information about building from source in theRuby README file.
Using the third-party tools or package managers might be a better idea,though, because the installed Ruby won’t be managed by any tools.
The listen
gem listens to file modifications and notifies you about the changes.
Listen
is currently accepting more maintainers. Please read this if you're interested in joining the team.
Features
- OS-optimized adapters on MRI for Mac OS X 10.6+, Linux, *BSD and Windows, more info below.
- Detects file modification, addition and removal.
- You can watch multiple directories.
- Regexp-patterns for ignoring paths for more accuracy and speed
- Increased change detection accuracy on OS X HFS and VFAT volumes.
- Continuous Integration: tested on selected Ruby environments via Github Workflows.
Issues / limitations
- Limited support for symlinked directories (#279):
- Symlinks are always followed (#25).
- Symlinked directories pointing within a watched directory are not supported (#273- see Duplicate directory errors).
- No directory/adapter-specific configuration options.
- Support for plugins planned for future.
- TCP functionality was removed in
listen
3.0.0 (#319, #218). There are plans to extract this feature to separate gems (#258), until this is finished, you can use by locking thelisten
gem to version'~> 2.10'
. - Some filesystems won't work without polling (VM/Vagrant Shared folders, NFS, Samba, sshfs, etc.).
- Specs suite on JRuby and Rubinius aren't reliable on Travis CI, but should work.
- Windows and *BSD adapter aren't continuously and automatically tested.
- OSX adapter has some performance limitations (#342).
- FreeBSD users need patched version of rb-kqueue (as of 2020/11). See #475 for the issue, mat813/rb-kqueue#12 for the patch, and Bug 250432 in bugzilla.
- Listeners do not notify across forked processes, if you wish for multiple processes to receive change notifications you must listen inside of each process.
Pull requests or help is very welcome for these.
Install
The simplest way to install listen
is to use Bundler.
Complete Example
Here is a complete example of using the listen
gem:
Running the above in the background, you can see the callback block being called in response to each command:
Usage
Call Listen.to
with one or more directories and the 'changes' callback passed as a block.
Changes Callback
Changes to the listened-to directories are reported by the listener thread in a callback.The callback receives three array parameters: modified
, added
and removed
, in that order.Each of these three is always an array with 0 or more entries.Each array entry is an absolute path.
Pause / unpause / stop
Listeners can also be easily paused/unpaused:
Rocstor 5.9 inch mini displayport to vga adapter for mac. Note: While paused, listen
keeps on collecting changes in the background - to clear them, call stop
.
Note: You should keep track of all started listeners and stop
them properly on finish.
Ignore / ignore!
Listen
ignores some directories and extensions by default (See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer).You can add ignoring patterns with the ignore
option/method or overwrite default with ignore!
option/method.
Note: :ignore
regexp patterns are evaluated against relative paths.
Note: Ignoring paths does not improve performance, except when Polling (#274).
Only
Listen
watches all files (less the ignored ones) by default. If you want to only listen to a specific type of file (i.e., just .rb
extension), you should use the only
option/method.
How To Install And Run Ruby On Mac OS X - Dummies
Note: :only
regexp patterns are evaluated only against relative file paths.
Options
All the following options can be set through the Listen.to
after the directory path(s) params.
Logging and Debugging
Listen
logs its activity to Listen.logger
.This is the primary method of debugging.
Custom Logger
You can call Listen.logger =
to set a custom listen
logger for the process. For example:
Rubygems Issues For Mac Os
Default Logger
If no custom logger is set, a default listen
logger which logs to to STDERR
will be created and assigned to Listen.logger
.
The default logger defaults to the error
logging level (severity).You can override the logging level by setting the environment variable LISTEN_GEM_DEBUGGING=<level>
.For <level>
, all standard ::Logger
levels are supported, with any mix of upper-/lower-case:
The default of error
will be used if an unsupported value is set.
Note: The alternate values 1
, 2
, true
and yes
shown above are deprecated and will be removed from listen
v4.0.
Disabling Logging
If you want to disable listen
logging, set
Listen Adapters
The Listen
gem has a set of adapters to notify it when there are changes.
There are 4 OS-specific adapters to support Darwin, Linux, *BSD and Windows.These adapters are fast as they use some system-calls to implement the notifying function.
There is also a polling adapter - although it's much slower than other adapters,it works on every platform/system and scenario (including network filesystems such as VM shared folders).
The Darwin and Linux adapters are dependencies of the listen
gem so they work out of the box. For other adapters a specific gem will have to be added to your Gemfile, please read below.
The listen
gem will choose the best adapter automatically, if present. If youwant to force the use of the polling adapter, use the :force_polling
optionwhile initializing the listener.
On Windows
If you are on Windows, it's recommended to use the wdm
adapter instead of polling.
Please add the following to your Gemfile:
On *BSD
If you are on *BSD you can try to use the rb-kqueue
adapter instead of polling.
Please add the following to your Gemfile:
Getting the polling fallback message?
Please visit the installation section of the Listen WIKI for more information and options for potential fixes.
Issues and Troubleshooting
If the gem doesn't work as expected, start by setting LISTEN_GEM_DEBUGGING=debug
or LISTEN_GEM_DEBUGGING=info
as described above in Logging and Debugging.
NOTE: without providing the output after setting the LISTEN_GEM_DEBUGGING=debug
environment variable, it is usually impossible to guess why listen
is not working as expected.
Questions / Discussion Area - RubyGems.org Support
See TROUBLESHOOTING
Performance
If listen
seems slow or unresponsive, make sure you're not using the Polling adapter (you should see a warning upon startup if you are).
Also, if the directories you're watching contain many files, make sure you're:
- not using Polling (ideally)
- using
:ignore
and:only
options to avoid tracking directories you don't care about (important with Polling and on MacOS) - running
listen
with the:latency
and:wait_for_delay
options not too small or too big (depends on needs) - not watching directories with log files, database files or other frequently changing files
- not using a version of
listen
prior to 2.7.7 - not getting silent crashes within
listen
(seeLISTEN_GEM_DEBUGGING=debug
) - not running multiple instances of
listen
in the background - using a file system with atime modification disabled (ideally)
- not using a filesystem with inaccurate file modification times (ideally), e.g. HFS, VFAT
- not buffering to a slow terminal (e.g. transparency + fancy font + slow gfx card + lots of output)
- ideally not running a slow encryption stack, e.g. btrfs + ecryptfs
When in doubt, LISTEN_GEM_DEBUGGING=debug
can help discover the actual events and time they happened.
See also Tips and Techniques.
Development
- Documentation hosted at RubyDoc.
- Source hosted at GitHub.
Pull requests are very welcome! Please try to follow these simple rules if applicable:
- Please create a topic branch for every separate change you make.
- Make sure your patches are well tested. All specs must pass on Travis CI.
- Update the Yard documentation.
- Update the README.
- Please do not change the version number.
For questions please join us in our Google group or on#guard
(irc.freenode.net).
Releasing
Prerequisites
- You must have commit rights to the GitHub repository.
- You must have push rights for rubygems.org.
How to release
- Run
bundle install
to make sure that you have all the gems necessary for testing and releasing. - Ensure all tests are passing by running
bundle exec rake
. - Determine which would be the correct next version number according to semver.
- Update the version in
./lib/listen/version.rb
. - Update the version in the Install section of
./README.md
(gem 'listen', '~> X.Y'
). - Commit the version in a single commit, the message should be 'Preparing vX.Y.Z'
- Run
bundle exec rake release:full
; this will tag, push to GitHub, and publish to rubygems.org. - Update and publish the release notes on the GitHub releases page if necessary
Acknowledgments
- Michael Kessler (netzpirat) for having written the initial specs.
- Travis Tilley (ttilley) for this awesome work on fssm & rb-fsevent.
- Natalie Weizenbaum (nex3) for rb-inotify, a thorough inotify wrapper.
- Mathieu Arnold (mat813) for rb-kqueue, a simple kqueue wrapper.
- Maher Sallam for wdm, windows support wouldn't exist without him.
- Yehuda Katz (wycats) for vigilo, that has been a great source of inspiration.
Author
Thibaud Guillaume-Gentil (@thibaudgg)