iOS Yosemite sudo npm install -g DYLD_ environment - ios

I have a problem after I upgraded my machine to Yosemite, whenever I run sudo npm install -g ... I got an error says
/usr/bin/dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
For example was trying to install gulp using
sudo npm install -g gulp
and got the same error ! not able to find the reason behind this issue

Generally this means that an existing, globally installed package is in bad shape. Possibly permissions related, but hard to say for sure without more information about the environment.
The solution lies in fixing the broken package. One way to do so is delete and re-install it. Try sudo npm uninstall -g <pkg> where <pkg> is anything you suspect may be broken.
If you are not sure where to start, do:
npm list -g --depth=0
That will show you all of your globally installed packages. Just remove and re-install them one by one.
If any of those throw errors during the removal process, you will need to do it yourself, manually.
First, figure out where global packages are installed. Generally, this will be /usr/local on OS X, for example. To find out for sure:
npm config get prefix
Then explore that directory, especially /usr/local/bin (for example) and if you are sure a file is related to a global npm package, it's usually safe to remove it.
`sudo rm -rf <file>`
... where <file> is the actual filename you wish to delete.
You may have gotten into this mess due to overuse of sudo.
See my answer to SNAFU with npm update -g on why sudo is bad and instructions on how to fix it.

Related

How to fix Shell Script Invocation Error MapFileParser.sh: Permission denied in Xcode

I'm working on a IOS Game that I built using Unity and I'm trying to get it to build on Xcode. However I keep getting this Shell Script Invocation Error "/Users/masterolu/Downloads/ShoeJackCityBuilds/iOS/MapFileParser.sh: Permission denied".
I've tried to use chmod +x /Users/masterolu/Downloads/ShoeJackCityBuilds/iOS/MapFileParser.sh but for some reason my machine doesn't recognize the chomd command anymore. I tried to reinstall it by using sudo apt install --reinstall coreutils but in order to use apt I need a JDK(Java Developer Kit). So I install the latest JDK and when I try to reinstall chomd my terminal says "Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home/bin/apt" (-1)". At this point I decided it's best to come and ask for help.
Any ideas on how to fix this error in Xcode or how to install chomd so my app can run?
So, apparently Apple likes to disable the execution permission of all the shell scripts that have not been created on your machine (i.e. downloaded from web, cloned from repo) so what you have to do is to open a terminal inside the project folder and run chmod -x MapFileParser.sh, that should fix it.
I have also done it on the process_symbols.sh just to be sure it runs.
## EDIT ##
My solution for my gihub action was this as the -x version did not work correctly for my scenario.
- name: Update scripts permissions
run: |
pwd
sudo chmod 755 MapFileParser.sh
sudo chmod 755 process_symbols.sh
This works for me:
chmod 777 MapFileParser.sh

Is it safe to force remove /usr/local/lib/docker to fix a Homebrew permission issue?

I'm trying to cleanup my installed packages using brew cleanup but keep getting the message Permission denied # apply2files - /usr/local/lib/docker/cli-plugins.
I tried changing the ownership of /usr/local/lib/docker/cli-plugins using sudo chown $(whoami) /usr/local/lib/docker/cli-plugins then ran brew cleanup again but this got the same result.
It might be worth noting that I do not use the Docker application anymore and don't even have it installed anymore. So I was wondering if simply force removing the /docker directory using the rm -rf /usr/local/lib/docker/ command would help? Or would that do more harm than good?
I don't think there would be any issue of deleting or reinstalling /usr/local/lib/docker/. You should be always re-installing the right Docker app and brew link it for the use.
But before you are doing that, I'd recommend you to run brew doctor first.

Built stuck at 0.0% while bundling index.ios.js

I don't know exactly why but all my react-native projects cannot build anymore today and I'm stuck with a the Bundling of index.ios.js at 0.0%.
I tried a couple of things but all my projects got the same issue.
NOTE: This workaround is for macOS.
Found out that the culprit was watchman 4.7.0.
My issues started after having upgraded to watchman 4.7.0 using brew.
Looks like there's an issue in this new version of watchman:
watchman issues 358.
At the end I solved my issue removing the content of the /usr/local/var/run/watchman/ folder.
I tried several things: the above answer, launchctl unload, restart, reinstall... You name it. Here's how I fixed it on MacOS:
TL;DR: Remove brew version and follow official documentation to compile from source. Use flags on configure: --enable-statedir=$HOME/.watchman --without-python --without-pcre
Reasoning: I don't need python bindings. I also suspect some permission issues and thought using my home would be safer than default path.
steps:
brew rm watchman
(just to be safe) launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist
(just to be safe) restart mac
git clone https://github.com/facebook/watchman.git
cd watchman
git checkout v4.9.0 // Prefer lastest version here.
brew install autoconf automake libtool // Compilation tools
./autogen.sh
./configure --enable-statedir="$HOME/.watchman" --without-python --without-pcre
make // Wait... It'll compile the .o files
make install // If it fails try with sudo but it shouldn't.
After make install it should be in your path here: /usr/local/bin/watchman
Try to watchman version or something. Try to see if it fixed your problem.
Keep in mind most people have their stuff in /usr/local/var/run/watchman/. Our equivalent is now ~/.watchman/
Let me know if this helps you. :)
run the following command
echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
This also may happen in case your node dependencies are not installed, e.g. node-modules/ in .gitignore and repo is freshly-pulled.
In this case, your should do npm install of yarn (in case you are using yarn).

Homebrew - repeated "linking" bug. What is the underlying issue here?

So I've been using homebrew to install various packages/libraries/programs on my mac. I keep running into a problem in which homebrew tells me that I have unlinked kegs in my Cellar.
For instance, upon running brew install phantomjs I received the following message:
Warning: Could not link phantomjs. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link phantomjs'
Possible conflicting files are:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I tried running brew link phantomjs as recommended, and hit a similar problem:
Error: Could not symlink file: /usr/local/Cellar/phantomjs/1.9.2/bin/phantomjs
Target /usr/local/bin/phantomjs already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
brew link --overwrite formula_name
The command brew link --overwrite --dry-run phantomjs gives the following message:
Would remove:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I will probably go ahead and overwrite, but this appears to happen every time I try to install something with homebrew. Why? Why isn't homebrew working as expected?
Thanks.
From what I can tell, looks like you have previously done:
% sudo npm install -g phantomjs
In this case, you should do the following:
% sudo npm uninstall -g phantomjs
% brew link --overwrite phantomjs
I thought I'd take a crack at this. I ran into a similar problem today, and I think it may be related to this:
https://github.com/Homebrew/homebrew/issues/22408
Long story short, I think it has to do with how npm manages packages vs how brew does it. (I'm assuming you installed node with its defaults, which would have given you npm).
At some point you probably installed some package with npm. Maybe grunt, karma, etc..those by default end up in /usr/local/lib/node_modules.
Maybe one of those packages or its dependencies(or sub-dependencies) depended on phantomjs (I think Karma might use phantomjs?) Anyways, if now you are trying to brew install phantomjs, which is trying to make a symlink to it, that may be conflicting with the already existing symlink that npm created for you..
I think you can change the symlink path for that package so that brew permanently points to that already installed package in the node_modules folder. Sorry not to be more specific, I'm just figuring this out myself.

How to remove a Yeoman generator

I accidentally installed a generator that I don't want.
I can't find any method to remove it.
What should I do to accomplish this?
Generators are just normal npm modules, so you can remove it with
npm uninstall -g generator-[nameOfGenerator]
npm uninstall -g [generator-name] might not fix the UNMET DEPENDENCY.
If you won't mind to reinstall the affected modules:
cd to your npm directory (e.g. /usr/local/bin/node_modules)
rm -rf [generator-name]
npm cache clean
npm install -g [generator-name]
Search for generators with
npm list -g --depth=0 | grep 'generator'
Remove generator with
npm uninstall -g [generator-name]
NOTE: Don't include '#[version] ' that follows the generator name
I wanted to add something for posterity:
If you get an number of errors of class 'peerDependencies' for yeoman's generators, updating yo alone will not cut it - you need to remove all generators that throw the error and then reinstall whatever module lead to the trouble.
Unfortunately, as far as I ahve chekced, regex is not supported by npm.

Resources