Got this error message:

[sudo] password for saeedeh: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ruby

What should I do?

  • 1
    Check your repository settings - Ruby is packaged as ruby. What Ubuntu version do you have?
    – N0rbert
    Jan 24, 2018 at 16:20
  • "Unable to locate" a package that is in the Ubuntu repos (like ruby) means that your apt data base is either empty or corrupt. Run sudo apt update to populate the apt database, then try installing ruby again.
    – user535733
    Jan 24, 2018 at 17:54
  • First thing is to make sure that you are using one of the currently supported releases Jan 24, 2018 at 18:19
  • my ubuntu version 17.04
    – saeedeh
    Jan 25, 2018 at 8:20

1 Answer 1


As @N0rbert said, It probably depends on version of Ubuntu you're working on. You could test sudo apt-get update and then run sudo apt-get install ruby-full again.

If above mentioned method fails, you must try other methods. Ruby official site states:

There are several ways to install Ruby:

When you are on a UNIX-like operating system, using your system’s package manager is the easiest way of getting started. However, the packaged Ruby version usually is not the newest one.

Installers can be used to install a specific or multiple Ruby versions. There is also an installer for Windows.

Managers help you to switch between multiple Ruby installations on your system.

And finally, you can also build Ruby from source.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .