What is basic filesystem structure for macOS (Mojave) /usr/ at root? - macos

I am cleaning up my MacBook and would like to know the basic /usr/ filesystem structure so that I can delete components that are not essential in running my system, in order to have an idea about what not to touch. I got curious about this after cleaning out the /usr/local/ directory to reinstall Homebrew and to save storage on my laptop.
So the following is what I see at /usr/ with my Terminal:
lrwxr-xr-x 1 root wheel 8 Dec 25 2018 X11 -> /opt/X11
lrwxr-xr-x 1 root wheel 8 Dec 25 2018 X11R6 -> /opt/X11
drwxr-xr-x 971 root wheel 31072 May 22 05:52 bin
drwxr-xr-x 265 root wheel 8480 Jun 5 23:39 include
drwxr-xr-x 322 root wheel 10304 Jun 5 23:39 lib
drwxr-xr-x 250 root wheel 8000 May 22 05:52 libexec
drwxr-xr-x 15 root wheel 480 Jul 14 07:09 local
drwxr-xr-x 239 root wheel 7648 May 22 05:52 sbin
drwxr-xr-x 46 root wheel 1472 Oct 19 2018 share
drwxr-xr-x 5 root wheel 160 Sep 21 2018 standalone
Is there anything not needed that I can prune in this directory? Or should I leave things as they are?

I think it would be better to leave it as it is.
for example: the bin include lib folder contains the installed applications and compiled libraries on your Mac, so you could remove something from it and then once of the dependencies will be upset.
I believe it's better to not change any thing inside the usr folder

Related

how to set up a dotnet5.0 solution to compile / build on macbook pro with m1 chip?

I just changed my dev machine from a windows box to a macbook pro (m1 chip). I need to be able to build / compile / debug a dotnet 5.0 project.
I'm assuming I can download multiple versions of the SDK and runtimes on my mac ... like the net6.0 for arm64 bit and net5.0 x64. (doesn't seem to be arm64 for .net 5.0 per the docs)
I've installed both SDKS using these two dotnet installers you see below:
me#MmMacBook-Pro ~ % ls -lah ~/Downloads
total 1469464
drwx------+ 10 me staff 320B 23 Jan 14:01 .
drwxr-x---+ 27 me staff 864B 23 Jan 14:00 ..
-rw-r--r--# 1 me staff 6.0K 23 Jan 13:41 .DS_Store
-rw-r--r-- 1 me staff 0B 21 Jan 15:07 .localized
-rw-r--r--# 1 me staff 104M 21 Jan 23:24 VSCode-darwin-arm64.zip
-rw-r--r--# 1 me staff 167M 22 Jan 14:38 azuredatastudio-macos-1.34.0.zip
-rw-r--r--# 1 me staff 261M 23 Jan 13:17 dotnet-sdk-5.0.404-osx-x64.pkg
-rw-r--r--# 1 me staff 159M 23 Jan 13:38 dotnet-sdk-6.0.101-osx-arm64.pkg
-rw-r--r--# 1 me staff 26M 21 Jan 23:53 git-2.33.0-intel-universal-mavericks.dmg
I didn't get any errors during either install. But at this point, when I check the list of dotnet sdks, I only see the 6.0 version:
me#Mm-MacBook-Pro ~ % dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.1
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.101/
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
.NET SDKs installed:
6.0.101 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
me#Mm-MacBook-Pro ~ % dotnet --list-sdks
6.0.101 [/usr/local/share/dotnet/sdk]
When I manually check the contents of /usr/local/share/dotnet I see that I have an x64 folder:
me#Mm-MacBook-Pro ~ % ls -lah /usr/local/share/dotnet/
total 456
drwxr-xr-x 12 root wheel 384B 23 Jan 14:10 .
drwxr-xr-x 3 root wheel 96B 22 Jan 15:08 ..
-rw-r--r-- 1 root wheel 1.1K 17 Nov 13:14 LICENSE.txt
-rw-r--r-- 1 root wheel 77K 17 Nov 13:14 ThirdPartyNotices.txt
-rwxr-xr-x 1 root wheel 142K 23 Nov 14:58 dotnet
drwxr-xr-x 3 root wheel 96B 17 Nov 13:30 host
drwxr-xr-x 6 root wheel 192B 23 Jan 14:10 packs
drwxr-xr-x 3 root wheel 96B 20 Nov 01:14 sdk
drwxr-xr-x 3 root wheel 96B 20 Nov 01:15 sdk-manifests
drwxr-xr-x 4 root wheel 128B 22 Jan 15:08 shared
drwxr-xr-x 3 root wheel 96B 20 Nov 01:15 templates
drwxr-xr-x 10 root wheel 320B 23 Jan 13:58 x64
Can someone point me in the right direction / tell me where I'm going wrong?
Just to be sure that the 6.0 install is working, I spun up a new project like this:
dotnet new webapp
and I was able to compile.
Thanks.
Édit 1
Per the comments just going to upgrade the project to 6.0.

Can't seem to download or uninstall HomeBrew

Error when installing
Error when uninstalling
Currently trying to help a fellow student install HomeBrew but getting this error every time we are trying to download HomeBrew. Tried various scripts for uninstalling as well but also getting errors.
Any solutions?
This is my /usr/local/bin directory (you don't need sudo permission for it):
$ ls -al /usr/local/bin | less
drwxr-xr-x 2466 ruichen admin 78912 Oct 22 00:46 .
drwxr-xr-x 21 root wheel 672 Aug 22 18:21 ..
-rw-r--r-- 1 ruichen admin 0 Oct 23 2019 .keepme
lrwxr-xr-x 1 ruichen admin 37 Oct 16 13:56 2to3 -> ../Cellar/python#3.9/3.9.7_1/bin/2to3
lrwxr-xr-x 1 ruichen admin 41 Oct 16 13:56 2to3-3.9 -> ../Cellar/python#3.9/3.9.7_1/bin/2to3-3.9
lrwxr-xr-x 1 ruichen admin 38 Sep 8 00:51 411toppm -> ../Cellar/netpbm/10.86.24/bin/411toppm
lrwxr-xr-x 1 ruichen admin 37 Nov 1 2020 4channels -> ../Cellar/libraw/0.20.2/bin/4channels
...

Yosemite upgrade broke ruby.h

Ever since upgrading to Yosemite, I get this error trying to build anything that includes ruby.h:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
^
1 error generated.
make[1]: *** [objects/if_ruby.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [first] Error 2
And sure enough, /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/config.h is indeed missing.
$ ls -laF /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/
total 72
drwxr-xr-x 21 root wheel 714 Jul 29 21:56 ./
drwxr-xr-x 5 root wheel 170 Jul 29 21:56 ../
drwxr-xr-x 7 root wheel 238 Jul 29 21:56 backward/
-rw-r--r-- 2 root wheel 3360 Sep 21 15:25 debug.h
-rw-r--r-- 2 root wheel 5553 Sep 21 15:25 defines.h
-rw-r--r-- 2 root wheel 881 Sep 21 15:25 digest.h
-rw-r--r-- 2 root wheel 7628 Sep 21 15:25 dl.h
-rw-r--r-- 2 root wheel 14123 Sep 21 15:25 encoding.h
-rw-r--r-- 2 root wheel 32904 Sep 21 15:25 intern.h
-rw-r--r-- 2 root wheel 5869 Sep 21 15:25 io.h
-rw-r--r-- 2 root wheel 4522 Sep 21 15:25 missing.h
-rw-r--r-- 2 root wheel 37617 Sep 21 15:25 oniguruma.h
-rw-r--r-- 2 root wheel 1502 Sep 21 15:25 re.h
-rw-r--r-- 2 root wheel 890 Sep 21 15:25 regex.h
-rw-r--r-- 2 root wheel 49734 Sep 21 15:25 ruby.h
-rw-r--r-- 2 root wheel 4651 Sep 21 15:25 st.h
-rw-r--r-- 2 root wheel 374 Sep 21 15:25 subst.h
-rw-r--r-- 2 root wheel 1102 Sep 21 15:25 thread.h
-rw-r--r-- 2 root wheel 2139 Sep 21 15:25 util.h
-rw-r--r-- 2 root wheel 1968 Sep 21 15:25 version.h
-rw-r--r-- 2 root wheel 1794 Sep 21 15:25 vm.h
Did the install accidentally a file? Does Yosemite just ship with a busted Ruby header file set?
What's the best way to fix this? Can I just unpack the source code in there to get the right headers?
One note on this: I ran into this problem after upgrading to "OS X El Capitan". I installed the command line tools by running 'xcode-select --install'. After that, my ruby build environment started working again.
For those who already had Xcode installed from the Apple developers site, running xcode-select --install doesn't work, since it will say that Xcode is already installed (Xcode already comes with the CommandLineTools bundled).
In my case, I fixed it by downloading the corresponding CommandLineTools from the same place, executing it, then going to /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg and executing it too.
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby
sudo ln -s ../universal-darwin15/ruby/config.h ./config.h
updates Nicholas Tsipanov's answer from 2014-10-18.
I got the same error, but installed "Command Line Tools (OS X 10.10) for Xcode - Xcode 6.1" and installing worked fine after that.
If you use Homebrew, brew install ruby is a fast workaround (it gets you a brand new ruby installation distinct from the one from Xcode).
Try this:
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby
sudo ln -s ../universal-darwin13/ruby/config.h ./config.h
Xcode got messed up in the upgrade somehow.
I opened Xcode (which I never do otherwise) and it complained about all sorts of missing components. So I let it go ahead and fix itself, and now all is well.
Props to CDub in the comments on OP for pointing to this as a potential source of weirdness.
I am running Mojave 10.14.6. The answer here fixed the subject issue for me: https://stackoverflow.com/a/58084238/284651
Solution:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
sudo xcodebuild -license accept
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Fixed by pointing to correct path for Xcode developer tools.
Error before (Note the path to Xcode711.app instead of Xcode.app)
/Applications/Xcode711.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/ruby.h:24:10:
Ran
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

"No Gemfile found" error in Run configurations for IntelliJ + Ruby plugin

I've tried to configure my IntelliJ 13.1.5 + Ruby 6.5.2 plugin to run RSpec tests.
When I go to Run -> Edit Configurations and check the checkbox "Run the script in context of the bundle (bundle exec)" in Bundler tab, I get error "Run configuration error: No Gemfile found". See attached screenshot.
My Gemfile is definitely present in the root of working directory. Look for ls -la output below:
drwxr-xr-x 27 lukasm staff 918 27 Oct 09:23 .
drwxr-xr-x 38 lukasm staff 1292 13 Oct 15:53 ..
-rw-r--r--# 1 lukasm staff 6148 20 Oct 11:12 .DS_Store
drwxr-xr-x 16 lukasm staff 544 27 Oct 15:50 .git
-rw-r--r-- 1 lukasm staff 334 7 Jul 12:14 .gitignore
drwxr-xr-x 13 lukasm staff 442 27 Oct 15:51 .idea
-rw-r--r-- 1 lukasm staff 203 29 Aug 11:02 .rubocop.yml
-rw-r--r-- 1 lukasm staff 4 7 Jul 12:14 .ruby-gemset
-rw-r--r-- 1 lukasm staff 6 8 Jul 10:51 .ruby-version
-rw-r--r-- 1 lukasm staff 704 20 Oct 18:30 CPS.iml
-rw-r--r-- 1 lukasm staff 396 3 Sep 15:13 Gemfile
-rw-r--r-- 1 lukasm staff 2919 16 Oct 15:04 Gemfile.lock
-rw-r--r-- 1 lukasm staff 3426 7 Jul 12:14 README.md
-rw-r--r-- 1 lukasm staff 7436 24 Oct 17:54 Rakefile
drwxr-xr-x 3 lukasm staff 102 27 Oct 11:42 config
-rw-r--r-- 1 lukasm staff 5234 13 Oct 16:02 config.yml
-rw-r--r-- 1 lukasm staff 7771 29 Sep 09:46 dump.rdb
-rw-r--r-- 1 lukasm staff 366256 5 Oct 10:28 eir_access.log
-rw-r--r-- 1 lukasm staff 528 26 Sep 16:15 eir_error.log
drwxr-xr-x 10 lukasm staff 340 5 Aug 12:29 lib
-rw-r--r-- 1 lukasm staff 2168 11 Jul 11:13 results.xml
drwxr-xr-x 4 lukasm staff 136 5 Aug 12:29 scripts
drwxr-xr-x 9 lukasm staff 306 20 Oct 11:12 spec
drwxr-xr-x 2 lukasm staff 68 8 Jul 16:38 src
drwxr-xr-x 9 lukasm staff 306 16 Oct 15:04 stub_data
drwxr-xr-x 6 lukasm staff 204 27 Oct 13:55 tmp
-rw-r--r-- 1 lukasm staff 472 7 Jul 12:14 uris.yaml
Question: how can I fix that error "Run configuration error: No Gemfile found" ?
I ran into the same issue today and after many hours I was able to fix it.
The environment where this issue occurred was: Ubuntu 14.04.1, IntelliJ 13.1.5, Test::Unit Test runner UI attached for framework, RubyMine plugin 6.0.0.20140123, rbenv and Ruby 2.0.0-p594
To resolve this "Run Configuration error: No Gemfile found", I had to:
Delete the Gemfile.lock located at the root of the project
From the shell command line, navigate to the project root folder and run "bundle install" so that Bundler started fetching gem metadata from https://rubygems.org/........
Go back to Intellij and reselect an SDK for the project at File -> Project Structure
Go to edit configuration, delete and recreated the rake configuration
I hope this would work for you... I also did other steps that I don't think they were necessary like restarting Intellij, reimporting the project, checking on and off the Test::Unit and the bundler option
Last, I want to share the steps that I had to do to reproduce this issue from scratch:
Imported a ruby project into Intellij
From the shell command, installed rbenv then installed ruby 2.0.0-p594
From Intellij, navigated to File -> Project Structure -> Project and set the SDK to rbenv 2.0.0-p594
From the shell command, installed bundler as follows: gem install bundler
Then back to Intellij were I navigated again to File -> Project Structure -> Project and noticed that the SDK was set back to , I set the SDK back to rbenv 2.0.0-p594
As soon as I hit ok, a popup showed up in IntellJ asking to install Ruby Plugin Gem Manager so I clicked on "install missing gem" link
After the installation was over, I navigated to Edit Configuration, switched to Bundler tab and as soon as I selected Run the script in the context of Bundler check box, I got the "Run Configuration error: No Gemfile found"
So I think that installing bundler late in the project configuration process caused this issue to surface
I have the exact same error, but different rubymine version on Windows and I use Rack configuration tempalte, here is my answer generally it will be the same concept: RubyMine somehow only looks for Gemfile in the "Settings/Project: projectname/Project Structure" so if you copy and paste the missing Gemfile into the Parent Project directory it will get picked up. However, I think Rubymine should also scan for subdirectories where Gemfile existing to include it, or probably rubymine has a way to override the default Gemfile by specify another Gemfile location - this i do not know.
Issue resolved for me.
I had faced the same problem in RubyMine 2018.3.5 version. And I found that my project structure was
Parent Folder
-> Project Folder
-> Vendor folder
-> Gemfile (etc.)
when I changed the structure to
-> Project Folder
-> Vendor folder
-> Gemfile (etc.)
Then there was no complain about "No Gemfile Found"
The basic checks which I think is necessary to debug in Rubymine are
Set the project structure as above
Verify jruby version and its gems(Preferences -> Languages & Frameworks -> Ruby SDK & Gems) My Jruby Version is 9.1.7.0
In Run/Debug Configuration -> Bundler set the checkbox Run the script in context of bundle (bundle exec)
above points are basic ones to begin with, you might need to install the missing gem or right version of gem after this configuration.

Failed to install PyZMQ 13.1 for PyPy 2.0.2 on Ubuntu 12.04.2 LTS

I use pip install as root. Everything works with CPython because it doesn't use the cffi backend. With PyPy I get the following error:
ImportError: PyZMQ CFFI backend couldn't find zeromq: [Errno 2] No such file or directory:
'/********/site-packages/zmq/cffi_core/__pycache__/_cffi__g5368a726x67d4e236.c'
The '/**/site-packages/zmq/cffi_core/ directory exists and contains the following .py files(and correponding .pyc):
-rw-r--r-- 1 root 7.8K Jul 16 17:29 _cffi.py
-rw-r--r-- 1 root 406 Jul 16 17:29 constants.py
-rw-r--r-- 1 root 2.2K Jul 16 17:29 context.py
-rw-r--r-- 1 root 915 Jul 16 17:29 devices.py
-rw-r--r-- 1 root 551 Jul 16 17:29 error.py
-rw-r--r-- 1 root 1000 Jul 16 17:29 __init__.py
-rw-r--r-- 1 root 1.7K Jul 16 17:29 message.py
-rw-r--r-- 1 root 2.1K Jul 16 17:29 _poll.py
-rw-r--r-- 1 root 6.8K Jul 16 17:29 socket.py
-rw-r--r-- 1 root 1.1K Jul 16 17:29 stopwatch.py
But, there is no __pycache__ directory.
By poking around the cffi Python files (in particular verifier.py) I found that it can't find the following cffi_g5368a726x67d4e236.pypy-20.so. I couldn't find it anywhere either. I guess it is not built for some reason, but I didn't see any errors during pip install.
Does anyone have any idea?

Resources