install ruby gem (no write permissions)? - ruby

I get this error while trying to install sass
Should I use sudo before the install statement?
rd-macbook-pro:~ redres$ gem install css_parser
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
rd-macbook-pro:~ redres$
thanks, Rich

Yes you can use sudo or set gem path
mkdir -p /Users/redres/.gem/ruby/1.8
export GEM_PATH=/Users/redres/.gem/ruby/1.8
export GEM_HOME=/Users/redres/.gem/ruby/1.8
but i highly recommend to try using RVM https://rvm.io/rvm/install/
curl -L https://get.rvm.io | bash -s stable
to install and
rvm requirements
to get further information

If you aren't using a ruby version manager (like rvm or rbenv), you'll need to use sudo to install on system-level.

The reason of the error is because you are not logged in as the root user on terminal.
If you already have root use enable on your mac in terminal type (without the $)
$ su
If you dont have root user, you need to enable it using the following steps
From the Apple menu choose System Preferences….
From the View menu choose Users & Groups.
Click the lock and authenticate as an administrator account.
Click Login Options….
Click the “Edit…” or “Join…” button at the bottom right.
Click the “Open Directory Utility…” button.
Click the lock in the Directory Utility window.
Enter an administrator account name and password, then click OK.
Choose Enable Root User from the Edit menu.
Enter the root password you wish to use in both the Password and Verify fields, then click OK.
More at the same on http://support.apple.com/kb/ht1528
Atleast it works for me after getting stuck for couple of hours.

Related

Hombrew installation issue on macos Big Sur

Trying to install homebrew in my new corporate pc.
facing this issue-
el$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
Need sudo access on macOS (e.g. the user el needs to be an Administrator)!
P87111:~ el$
Checked System preferences->users and group
Seems like i am designated as an admin.
What could be a possible fix? Thanks.
This should be a comment but I don't have enough reputation.
Take a look at these duplicate posts - here and another one here.
The gist from both the aforementioned posts are as follows (three choices):
Choice 1: Install homebrew without root privileges:
For this, please read the homebrew's alternative install instructions for further information.
Choice 2: Make your user an administrator (using Terminal):
For this, first check if your user is an admin or not using sudo dseditgroup -o checknumber -m your-user-name admin. The output will be either Unable to find the user record or yes your-user-name is a member of admin. (If the latter, homebrew installation should work)
If the former, you need to make your user a member of admin using sudo dscl . -merge /Groups/admin GroupMembership your-user-name (more information about his command has been provided in this previous post.
Choice 3: Make your user an administrator (using System Preferences):
Go to System Preferences > Users & Groups & Current User > Check "Allow user to administer this computer".
Reboot in all cases

How to copy intl.so to /usr/lib/php/extensions

I wanted to try Moodle (LMS) on my computer. It requires intl extension.
I used sudo port install php71-intl and successfully installed php71-intl. But it also installed php71 and other dependencies on /opt/local/.
I am using Mac built-in php. Its directories are
/usr/lib/php/extensions/no-debug-non-zts-20160303
/usr/bin/php
I intended to copy the /opt/local/lib/php71/extensions/no-debug-non-zts-20160303/intl.so to /usr/lib/php/extensions/no-debug-non-zts-20160303. But terminal said Operation not permitted.
I tried sudo pecl install intl but failed with make error.
This method sudo port install php71-intl can install the intl.so successfully but in its own direcotry.
So how I can copy the intl.so? Thank you!
You have to disable SIP to do that. First, restart your Mac and before OS starts up, hold down Command-R and keep it held down until you see an Apple icon and a progress bar. Release. This boots you into Recovery. From the Utilities menu, select Terminal and at the prompt type exactly the following and then press Return: csrutil disable
Terminal should display a message that SIP was disabled. From the menu, select Restart. You can re-enable SIP by following the above steps, but using csrutil enable instead.
Find this file "environment.xml" and comment all lines that have "intl" and reload the page. Continue button appears and installation completes without any error. My instance started working like charm, I use it to test out and create courses with SCORM packages, no errors yet.
environment.xml file is located in "admin" folder of moodle directory

Vue CLI Fails to install for Mac Mojave

I get the following error when setting up a new Vue project:
npm install -g #vue/cli
Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
I got around this error by changing permissions for two directories:
Set permissions to Everyone - Read / Write for
/usr/local/lib/node_modules
/usr/local/bin
Open Finder.
Press Command +Shift+G. A dialog box opens.
Enter the path and click Go
Right-click the directory and select Get Info
Click the lock icon to allow changes and enter your credentials
In the Sharing & Permissions section change everyone to Read & Write
Click the cog icon and select Apply to enclosed items from the drop down
Confirm the prompt
Reference Article:
https://forum.vuejs.org/t/vue-cli-installation-fails-on-macos-mojave-10-14/45712/5
As far as I know, its not just a Vue Cli issue but can happen for any node module.
Often this happens if you installed NPM as an administrator or using Sudo. You can usually get around it by doing something like sudo npm install xxx-package-xxx But that really just compounds the problem down the road when lots of things need elevated privileges.
In my case uninstalling and re-installing Node + NPM with a new package (not the ones included with MacOS) kind of helped but I eventually ended up nuking my OS and installing everything fresh.

'Jenkins' user is not created on OS X install

When reading about Jenkins installation, many guides talk about that the installer created a user called 'Jenkins' on OS X. This user seems to be important for certain tasks.
However, installing Jenkins 2.32 using homebrew does not install this user here. Why is that - am I missing something?
Background: I want to run CI for iOS together with a Gitlab server.
Jenkins installed via Homebrew is kind of a mess - and I say this because it isn't terribly obvious in the log output where/who gets permissions.
Jenkins DOES NOT create a jenkins user on Mac OS (nor should it ever, imo).
By default, the user that was actively using brew install jenkins is the one who will get the default permissions. There should be a /.jenkins folder within that users home folder (ex: /Users/<your_user>/.jenkins)
The problem is that when brew finishes running, some files that should get symlinked to the active user don't - so you might create a job using rvm/ruby for example, and get errors that bundler can't write to the system ruby.
Try this in terminal/iTerm:
sudo chown whoami /Library/LaunchDaemons/homebrew.mxcl.jenkins.plist
also whoami should be surrounded by ticks `
I tend to just do these commands after a brew install jenkins
ln -sfv /usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents
Symlink the Jenkins plist files to /Library/LaunchAgents
sudo cp -fv /usr/local/opt/jenkins/*.plist /Library/LaunchDaemons
Copy plist files to /Library/LaunchDaemons
sudo chownwhoami/Library/LaunchDaemons/homebrew.mxcl.jenkins.plist
Give sudo ownership of the plist file listed to the user outright
This part isn't necessary...
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
Here's something to refer to:
http://flummox-engineering.blogspot.com/2016/01/installing-jenkins-os-x-homebrew.html

sudo access to specific folder

On mac mavericks, i want to install few files without prompting user for sudo password. (Folder where i am trying to install require root access because it is present at / location). I can do this by modifying "sudoer" file and disable sudo password but this is unsafe and open up security risk. Is there any way i can provide sudo access only a particular folder? So when i try to write to this folder, sudo password prompt is not visible to user.
(All above task are done through command line)
Thanks for your help.

Resources