Finally, the commands that I ran to solve the problem were the following, but I am not sure of the order or if they are all necessary, since I had problems installing them on two different computers and there are still things I do not understand:
If any of you can identify the correct order and if there are any more commands, it would be good to leave it ready for those who need it in the future.
Thanks to everyone who has helped me today. It is priceless help. I am in love with this beautiful community.
The message - pkg (local) is newer than pkg (repo) - is a default message.
It means the local package is newer than the repo and this can occur - espcially on stable branch - when an issue - a stable killer - has been discovered and the package has been downgraded by the maintainer.
I can - sometimes - be spotted on the pkgrel part of the version pkg-3.2.1-2.1.pkg.tar.zx
Your mirrorlist is maintained by pacman-mirrors (which on arch is something completely different).
You can check the state of your primary mirror (and other mirrors in the list) by running (either with or without the –status - same result)
pacman-mirrors --status
To reorder your mirrors - simply run
sudo pacman-mirrors -f
For other uses consult the man page
man pacman-mirrors
You shouldn’t have to run the gems installer as root as this will most likely cause issues at a later state - (days, weeks, months) - with conflicting files during repo sync.
Steps 5 to 7 can result in problems with system updates along the way. You might see errors like “exists in filesystem” the next time rubygem package gets an update. It is really a bad idea to use sudo with these commands.
This a the important command. Adding your $GEM_HOME/bin folder to your path. This would have fixed your problem with the system rubygems. Remember this warning?