Skip to content

Instantly share code, notes, and snippets.

@xxorax
Created September 21, 2016 17:43
Show Gist options
  • Save xxorax/b9c72428c20c61c9be033822205645d1 to your computer and use it in GitHub Desktop.
Save xxorax/b9c72428c20c61c9be033822205645d1 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Because packager sucks
gem list --local | grep '(' | sed -r 's/^([^ ]+)( \(.+)$/\1/' | xargs gem uninstall
apt-get purge --auto-remove ruby ruby-dev
# Optionnal (or not)
echo 'Package: <nameofpackage>
Pin: origin ""
Pin-Priority: -1' > /etc/apt/preferences.d/ruby
exit
# Or you can do as I do, to goi to the same conclusion :
# aptitude install ruby-dev
The following NEW packages will be installed:
libruby1.9.1{a} ruby{a} ruby-dev ruby1.9.1{a} ruby1.9.1-dev{a}
0 packages upgraded, 5 newly installed, 0 to remove and 3 not upgraded.
Need to get 3 562 kB of archives. After unpacking 16,9 MB will be used.
Do you want to continue? [Y/n/?] Y
Get: 1 http://fr.archive.ubuntu.com/ubuntu/ trusty/main ruby all 1:1.9.3.4 [5 334 B]
Get: 2 http://fr.archive.ubuntu.com/ubuntu/ trusty-updates/main ruby1.9.1 amd64 1.9.3.484-2ubuntu1.2 [35,6 kB]
Get: 3 http://fr.archive.ubuntu.com/ubuntu/ trusty-updates/main libruby1.9.1 amd64 1.9.3.484-2ubuntu1.2 [2 645 kB]
Get: 4 http://fr.archive.ubuntu.com/ubuntu/ trusty-updates/main ruby1.9.1-dev amd64 1.9.3.484-2ubuntu1.2 [871 kB]
Get: 5 http://fr.archive.ubuntu.com/ubuntu/ trusty/main ruby-dev all 1:1.9.3.4 [4 660 B]
Fetched 3 562 kB in 17s (199 kB/s)
Selecting previously unselected package ruby.
(Reading database ... 330702 files and directories currently installed.)
Preparing to unpack .../ruby_1%3a1.9.3.4_all.deb ...
Unpacking ruby (1:1.9.3.4) ...
Selecting previously unselected package ruby1.9.1.
Preparing to unpack .../ruby1.9.1_1.9.3.484-2ubuntu1.2_amd64.deb ...
Unpacking ruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Selecting previously unselected package libruby1.9.1.
Preparing to unpack .../libruby1.9.1_1.9.3.484-2ubuntu1.2_amd64.deb ...
Unpacking libruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Selecting previously unselected package ruby1.9.1-dev.
Preparing to unpack .../ruby1.9.1-dev_1.9.3.484-2ubuntu1.2_amd64.deb ...
Unpacking ruby1.9.1-dev (1.9.3.484-2ubuntu1.2) ...
Selecting previously unselected package ruby-dev.
Preparing to unpack .../ruby-dev_1%3a1.9.3.4_all.deb ...
Unpacking ruby-dev (1:1.9.3.4) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for menu (2.1.46ubuntu1) ...
Setting up ruby (1:1.9.3.4) ...
Setting up libruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Setting up ruby1.9.1-dev (1.9.3.484-2ubuntu1.2) ...
Setting up ruby-dev (1:1.9.3.4) ...
Setting up ruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Processing triggers for menu (2.1.46ubuntu1) ...
# gem install compass
Fetching: sass-3.4.22.gem (100%)
Fetching: multi_json-1.12.1.gem (100%)
Fetching: compass-core-1.0.3.gem (100%)
Fetching: compass-import-once-1.0.5.gem (100%)
Fetching: chunky_png-1.3.7.gem (100%)
Fetching: rb-fsevent-0.9.7.gem (100%)
Fetching: ffi-1.9.14.gem (100%)
Building native extensions. This could take a while...
/usr/lib/ruby/1.9.1/rubygems/ext/builder.rb:48: warning: Insecure world writable dir /home in PATH, mode 040757
Fetching: rb-inotify-0.9.7.gem (100%)
Fetching: compass-1.0.3.gem (100%)
Compass is charityware. If you love it, please donate on our behalf at http://umdf.org/compass Thanks!
Successfully installed sass-3.4.22
Successfully installed multi_json-1.12.1
Successfully installed compass-core-1.0.3
Successfully installed compass-import-once-1.0.5
Successfully installed chunky_png-1.3.7
Successfully installed rb-fsevent-0.9.7
Successfully installed ffi-1.9.14
Successfully installed rb-inotify-0.9.7
Successfully installed compass-1.0.3
9 gems installed
Installing ri documentation for sass-3.4.22...
Installing ri documentation for multi_json-1.12.1...
Installing ri documentation for compass-core-1.0.3...
Installing ri documentation for compass-import-once-1.0.5...
Installing ri documentation for chunky_png-1.3.7...
Installing ri documentation for rb-fsevent-0.9.7...
Installing ri documentation for ffi-1.9.14...
Installing ri documentation for rb-inotify-0.9.7...
Installing ri documentation for compass-1.0.3...
Installing RDoc documentation for sass-3.4.22...
Installing RDoc documentation for multi_json-1.12.1...
Installing RDoc documentation for compass-core-1.0.3...
Installing RDoc documentation for compass-import-once-1.0.5...
Installing RDoc documentation for chunky_png-1.3.7...
Installing RDoc documentation for rb-fsevent-0.9.7...
Installing RDoc documentation for ffi-1.9.14...
Installing RDoc documentation for rb-inotify-0.9.7...
Installing RDoc documentation for compass-1.0.3...
# aptitude purge ruby-dev
The following packages will be REMOVED:
ruby-dev{p}
0 packages upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
Need to get 0 B of archives. After unpacking 31,7 kB will be freed.
Do you want to continue? [Y/n/?] Y
(Reading database ... 331645 files and directories currently installed.)
Removing ruby-dev (1:1.9.3.4) ...
# sass
DEPRECATION WARNING:
Sass 3.5 will no longer support Ruby 1.9.3.
Please upgrade to Ruby 2.0.0 or greater as soon as possible.
^CInterrupt:
Use --trace for backtrace.
# apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
# apt-get purge --auto-remove ruby
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libruby1.9.1* ruby* ruby1.9.1* ruby1.9.1-dev*
0 upgraded, 0 newly installed, 4 to remove and 3 not upgraded.
After this operation, 16,9 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 302000 files and directories currently installed.)
Removing ruby1.9.1-dev (1.9.3.484-2ubuntu1.2) ...
Removing libruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Purging configuration files for libruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Removing ruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Purging configuration files for ruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Removing ruby (1:1.9.3.4) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Processing triggers for menu (2.1.46ubuntu1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
# sass
bash: /usr/local/bin/sass: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory
# aptitude install ruby-dev
The following NEW packages will be installed:
libruby1.9.1{a} ruby{a} ruby-dev ruby1.9.1{a} ruby1.9.1-dev{a}
0 packages upgraded, 5 newly installed, 0 to remove and 3 not upgraded.
Need to get 3 562 kB of archives. After unpacking 16,9 MB will be used.
Do you want to continue? [Y/n/?] Y
Get: 1 http://fr.archive.ubuntu.com/ubuntu/ trusty/main ruby all 1:1.9.3.4 [5 334 B]
Get: 2 http://fr.archive.ubuntu.com/ubuntu/ trusty-updates/main ruby1.9.1 amd64 1.9.3.484-2ubuntu1.2 [35,6 kB]
Get: 3 http://fr.archive.ubuntu.com/ubuntu/ trusty-updates/main libruby1.9.1 amd64 1.9.3.484-2ubuntu1.2 [2 645 kB]
Get: 4 http://fr.archive.ubuntu.com/ubuntu/ trusty-updates/main ruby1.9.1-dev amd64 1.9.3.484-2ubuntu1.2 [871 kB]
Get: 5 http://fr.archive.ubuntu.com/ubuntu/ trusty/main ruby-dev all 1:1.9.3.4 [4 660 B]
Fetched 3 562 kB in 26s (133 kB/s)
Selecting previously unselected package ruby.
(Reading database ... 301061 files and directories currently installed.)
Preparing to unpack .../ruby_1%3a1.9.3.4_all.deb ...
Unpacking ruby (1:1.9.3.4) ...
Selecting previously unselected package ruby1.9.1.
Preparing to unpack .../ruby1.9.1_1.9.3.484-2ubuntu1.2_amd64.deb ...
Unpacking ruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Selecting previously unselected package libruby1.9.1.
Preparing to unpack .../libruby1.9.1_1.9.3.484-2ubuntu1.2_amd64.deb ...
Unpacking libruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Selecting previously unselected package ruby1.9.1-dev.
Preparing to unpack .../ruby1.9.1-dev_1.9.3.484-2ubuntu1.2_amd64.deb ...
Unpacking ruby1.9.1-dev (1.9.3.484-2ubuntu1.2) ...
Selecting previously unselected package ruby-dev.
Preparing to unpack .../ruby-dev_1%3a1.9.3.4_all.deb ...
Unpacking ruby-dev (1:1.9.3.4) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for menu (2.1.46ubuntu1) ...
Setting up ruby (1:1.9.3.4) ...
Setting up libruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Setting up ruby1.9.1-dev (1.9.3.484-2ubuntu1.2) ...
Setting up ruby-dev (1:1.9.3.4) ...
Setting up ruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Processing triggers for menu (2.1.46ubuntu1) ...
# gem help
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
Usage:
gem -h/--help
gem -v/--version
gem command [arguments...] [options...]
Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
gem help platforms show information about platforms
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at
http://localhost:8808/
with info about installed gems
Further information:
http://rubygems.rubyforge.org
# gem uninstall --all
ERROR: While executing gem ... (Gem::CommandLineError)
Please specify at least one gem name (e.g. gem build GEMNAME)
# gem --version
1.8.23
# gem update --system
ERROR: While executing gem ... (RuntimeError)
gem update --system is disabled on Debian, because it will overwrite the content of the rubygems Debian package, and might break your Debian system in subtle ways. The Debian-supported way to update rubygems is through apt-get, using Debian official repositories.
If you really know what you are doing, you can still update rubygems by setting the REALLY_GEM_UPDATE_SYSTEM environment variable, but please remember that this is completely unsupported by Debian.
# gem list --local
*** LOCAL GEMS ***
chunky_png (1.3.7)
compass (1.0.3)
compass-core (1.0.3)
compass-import-once (1.0.5)
ffi (1.9.14)
multi_json (1.12.1)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
sass (3.4.22)
# gem list --local | grep '(' | sed -r 's/^([^ ]+)( \(.+)$/\1/' | xargs gem uninstall
Successfully uninstalled chunky_png-1.3.7
Removing compass
Successfully uninstalled compass-1.0.3
Successfully uninstalled compass-core-1.0.3
Successfully uninstalled compass-import-once-1.0.5
Successfully uninstalled ffi-1.9.14
Successfully uninstalled multi_json-1.12.1
Successfully uninstalled rb-fsevent-0.9.7
Successfully uninstalled rb-inotify-0.9.7
Removing sass
Removing sass-convert
Removing scss
Successfully uninstalled sass-3.4.22
# which sass
# apt-get purge --auto-remove ruby
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libruby1.9.1* ruby* ruby-dev* ruby1.9.1* ruby1.9.1-dev*
0 upgraded, 0 newly installed, 5 to remove and 3 not upgraded.
After this operation, 16,9 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 302004 files and directories currently installed.)
Removing ruby-dev (1:1.9.3.4) ...
Removing ruby1.9.1-dev (1.9.3.484-2ubuntu1.2) ...
Removing libruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Purging configuration files for libruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Removing ruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Purging configuration files for ruby1.9.1 (1.9.3.484-2ubuntu1.2) ...
Removing ruby (1:1.9.3.4) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Processing triggers for menu (2.1.46ubuntu1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment