How to 'undo' sudo gem install bundler

Hi, I’m new in the web world and when I was having trouble installing Jekyll on my Mac OS, I unintentionally used sudo command to install gem before seeing the warning sign on the troubleshooting page that it’s not a good idea.

I still haven’t grasped what the consequences of that would be, and is there a way to check something might have gone in my system (security breach, etc) or somehow ‘undo’ the sudo command and start everything from scratch?

I use Mac OS which has Ruby already installed but for some reason, I cannot run the gem install Jekyll bundler command to get started.

Any help in guiding me towards useful information would be greatly appreciated.

Hello.

You are right to be cautious with sudo installs and should avoid them.

On a once off use of sudo and installing bundler, a well-known and maintained gem, you’re unlikely to have any malicious code installed. If you used sudo regularly and used it on random gems that don’t get vetted by open source contributors, then you would worry.
A ton of code runs when install happens and it could have put stuff anywhere on your entire machine, so detecting a vulnerability is not easy. I don’t have any suggestions.

Uninstall:

sudo gem uninstall bundler 

And to install Bundler the user-level way for Catalina: