Could not set environment: 150: Operation not permitted while System Integrity Protection is engaged

Hi.

After the recent update of Ventura to 13.4 and Big Sur to 11.7.7

all of a sudden "launchctl setenv" returns the following errors.

Could not set environment: 150: Operation not permitted while System Integrity Protection is engaged

Is there any workaround to fix this?

Answered by DTS Engineer in 908142022
I need this with sudo.

At this point I think it’s safe to assume that:

  • This facility was removed…
  • Because of security concerns…
  • And thus it’s not coming back.

So, you have a couple of options:

  • Disable SIP
  • Find another path

I encourage you to do the latter because disabling SIP is very risky. Speaking personally, I only disable SIP on machines I don’t care about, typically VMs that I’m using for testing. If this is a machine you do care about, then disabling SIP is a bad idea.

As to what that other path might be, that’s hard to say without more information about your circumstances. If you’d like a specific suggestion, reply back with more details about what you’re trying to do.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi, did you find the solution? I have the same problem.

No Luck. Now it seems like there is no way to pass env variable to the installer.

Also looking for a workaround or alternative solution to this problem.

I think this issue is fixed in 13.4.1c

This error appears only when running with "sudo launchctl setenv", without "sudo" it works well.

I need this with sudo.

I need this with sudo.

At this point I think it’s safe to assume that:

  • This facility was removed…
  • Because of security concerns…
  • And thus it’s not coming back.

So, you have a couple of options:

  • Disable SIP
  • Find another path

I encourage you to do the latter because disabling SIP is very risky. Speaking personally, I only disable SIP on machines I don’t care about, typically VMs that I’m using for testing. If this is a machine you do care about, then disabling SIP is a bad idea.

As to what that other path might be, that’s hard to say without more information about your circumstances. If you’d like a specific suggestion, reply back with more details about what you’re trying to do.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Could not set environment: 150: Operation not permitted while System Integrity Protection is engaged
 
 
Q