Operation not permitted when trying to open tmux - macos

When I try to initiate tmux session it gives me the following error.
error creating /private/tmp/tmux-501 (Operation not permitted)
I am using apple M1 (Big Sur version 11.5.2). Any suggestion?

It was not just with tmux but I couldn't read/write on the /tmp folder even with sudo permission. This blocked me from using apps that require its use.
I couldn't find the actual reason behind it, I think it was locked by another program which terminated badly.
The only option I could have opted for at this point was to reboot my system.

Related

Read-only file system" with SIP disabled in macOS Catalina

I am trying to copy some files from a path to my libs path (/usr/lib), I am trying with sudo cp {my file}/usr/lib/
bit I got this error.
/usr/lib/{my_file} Read-only file system
I have validated and indeed System Integrity Protection is disabled (SIP) I am using macOs Catalina 10.15.4
I Hope you can help me thanks.
You just should try with
sudo mount -uw /
it should work
I just recently joined stack overflow so I am not able to up-vote the above answer. Using sudo mount -uw / definitely works. In my case I needed to add a small script to /sbin to overcome an issue with VMware Tools. Starting with macOS Catalina, disabling SIP and then executing this command as root was the answer.
I'm also new to stack exchange, but want to add that
"sudo mount -uw /" worked. Thank you #Juanse
In my case, was suffering from the problem of Kernel_Task using more than 500% of CPU on my Mid-2012 15 MacBookPro aka (MacBookPro9,1 ) with quad-code Intel Core i7.
After multiple solutions did not work, I went on to try a solution posted at: https://discussions.apple.com/thread/8461404?answerId=33657338022#33657338022
Which instructed me to:
Reboot into recovery mode.
Select Utilities/Terminal, csrutil disable , reboot.
cd:
/System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/X86PlatformPlugin.kext/Contents/Resources
move or delete a file based on my version of Mac as listed in the thread. For my MacBookPro9,1 the file 4B7AC7E43945597E.plist
Reboot into recovery mode
Select Utilities/Terminal, csrutil enable , reboot.
The problem with the solution, is that when I tried to "mv 4B7AC7E43945597E.plist ~", or even "sudo mv 4B7AC7E43945597E.plist ~", I got a read-only file system message. Running "sudo mount -uw /" made the file system writeable. Note that the steps of booting into recovery mode and disabling / enabling csrutil turned off, and then back on the apple System Integrity Protection (SIP), which is necessary if you wish to change certain key system or configuration files.

XQuartz $DISPLAY problems, cannot open xclock locally, cannot ssh -X

I am trying to solve a cascading series of bugs that started with me not able to copy to my macOS clipboard from remote ssh and has lead me to realize my X11 situation is seriously messed up. I have read a few other stackoverflow threads and they do not address my particular problems.
First my setup is macOS Mojave 10.14.5. I have xquartz 2.7.11 installed from the website. When I run echo $DISPLAY locally (on macOS) I get /private/tmp/com.apple.launchd.waagOnO6Qm/org.macosforge.xquartz:0.
Since I don't know where the error actually is I will list two problems I can identify currently.
Two problems:
If I run xclock locally nothing happens inside my terminal. I do notice that an "active" dot appears under the XQuartz dock icon for a second and then disappears. But after this happens my terminal still just hangs at xclock as though it is running.
If I try to ssh -X remote into a remote machine my terminal is locked out. I cannot keyboard interrupt. I ran this with -vvv to try to debug and I see that it hangs with xauth:
debug2: client_x11_get_proto: /opt/X11/bin/xauth -f /var/folders/jw/ltyk9x9n0_xb61jhdnct27fr0000gn/T//ssh-vcqwT7qh5yk2/xauthfile generate /private/tmp/com.apple.launchd.waagOnO6Qm/org.macosforge.xquartz:0 MIT-MAGIC-COOKIE-1 untrusted timeout 1260 2>/dev/null
Attempts to Solve
Other related stack threads have suggested reinstalling XQuartz, which I have done, both manually and with Homebrew. I have logged back out and in following reinstallation.
This thread suggested I solve my xauth problem by deleting .XAuthority file and recreating it. However, when I
xauth generate :0 . trusted
My XQuartz pops up a window saying XQuartz quit unexpectedly which I can provide the Report for if it helps. Then in the terminal it says
xauth: (argv):1: unable to open display ":0". Also I'm not sure this is the problem anyway because my .XAuthority file already contained an entry that it looks like this is trying to produce:
$HOST/unix:0 MIT-MAGIC-COOKIE-1 db7738324ca3662767b20b97b4a68680
Though it is concerning that running xauth is causing my xquartz to repeatedly quit unexpectedly (this dialog box is appearing multiple times).
This has been very frustrating to debug because I am not sure where the problem is, with xauth or xquartz somehow even though it is newly installed. Further, existing StackOverflow threads I have found detail the problem only with ssh -X but clearly I'm having problems locally, given that I can't even run xclock.
Any help is greatly appreciated.
The dot appearing and disappearing quickly indicates that the server process is terminating. This means that either the server crashed, the managing client (eg ~/.xinitrc) terminated, or we failed to even start xinit.
Almost every case I have ever seen of this has been due to someone doing something wrong in their init scripts (eg: ~/.bash*, ~/.profile, ~/.xinitrc).
Remove those and try again, then bisect to figure out the underlying issue.
However, the crash dialog from your "ssh" case indicates that it is likely the server crashing. You will need to look at the crash log for more information (or provide it here if you want help with that).

Bump: sudo gcore gives 'insufficient privilege' on a chrome tab process

Original post August 21, 2018: sudo gcore gives 'insufficient privilege' on a chrome tab process
I am only user on this macbook pro (high sierra) so I'm the only administrator.
Anytime I go into terminal and type "gcore PID" or "sudo gcore PID" I get the following:"gcore: insufficient privilege". (The actual PID I want is 7415)
The only reason I'm even attempting to do this is because yesterday I was filling out important information for a scholarship on a webpage in google chrome and an error occurred and I lost everything I typed. ....so I followed the instructions located here...https://superuser.com/questions/975744/how-do-i-recover-information-ive-typed-into-a-website-after-i-accidentally-lost
Yesterday I installed xcode, installed homebrew, and installed gcore. I also have user permission to read and write the folder "/etc" and the file "sudoers".
I have not deleted my chrome browsing data but I did restart my computer last night. I'm assuming the information I seek in the ram is gone?
Nonetheless I still want to figure out why the terminal says "gcore: insufficient privilege" after entering "sudo gcore 7415" when I am an administrator?
Thank you in advance to anyone who can answer this!

Lost permission for sudo in OSX El Capitan

I'm new to using OSX (using El Capitan 10.11.3) and while trying to change permissions on a file using sudo, I accidentally corrupted it. Now whenever, I try to use sudo to install anything globally, I'm getting the following error message.
sudo: unable to stat /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
Is there any way to solve it?
I'm also unable to even view the /etc folder
bash: cd: /etc: Permission denied
When I checked permissions on /etc folder, they are as follows
lrwxr-xr-x# 1 root wheel etc -> private/etc
I had the same issue and in my case the permissions of the root folder got corrupted. What people overlook is that / is in fact also a real, normal directory and just like every directory it has ownership and permissions. Ownership should be root:wheel and permission should be 755 (that's rwxr-xr-x).
The easiest way to restore both was starting Script Editor and then typing and running that script:
do shell script "/usr/sbin/chown root:wheel /" with administrator privileges
do shell script "/bin/chmod 755 /" with administrator privileges
You are prompted for amdin password and then chown and chmod come to the rescue. After that sudo was working again.
Disable System Integrity Protection (rootless)
Reboot the Mac and hold down Command + R keys simultaneously after you hear the startup chime, this will boot OS X into Recovery Mode
When the “OS X Utilities” screen appears, pull down the ‘Utilities’ menu at the top of the screen instead, and choose “Terminal”
Type the following command into the terminal then hit return:
csrutil disable; reboot
You’ll see a message saying that System Integrity Protection has been disabled and the Mac needs to restart for changes to take effect, and the Mac will then reboot itself automatically, just let it boot up as normal

Reset DNS Cache on Mac

I recently switched hosting services for my domain, and as I've been checking up on it recently, I've noticed that the changes have finished propagating, but my laptop (Mac OS X Mountain Lion, if that helps) still navigates to the old server when I type in the URL.
If I navigate to the page on any other device, it takes me to the new server. How can I reset my laptop's DNS cache? It happens in every browser, as well as displaying the old IP when I ping the domain from Terminal.
Could this have anything to do with my Wi-fi? My other devices are connected to the same network and are not experiencing the same problem.
dscacheutil -flushcache is what you are looking for. There is a manual page on developer.apple.com that describes its usage.
I think that sending a hangup to mDNSResponder is the new solution to flushing the cache though - sudo killall -HUP mDNSResponder should do the trick.
Note This probably should have been asked on http://apple.stackexchange.com instead.
You can save a .scpt file to your desktop for quicker access and simplicity.
open the "Script Editor", add the following command and save to your desktop:
Copy and paste the following line including quotes:
do shell script "sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say cache flush completed successfully" with administrator privileges
Then simply double-click the file overtime you need to flush :)
This works on El Capitan 10.11.x
Hope this helps!
screenShot

Resources