The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting.

Posts under Zsh tag

62 Posts

Post

Replies

Boosts

Views

Activity

zsh for-loop erroneously expanding file extension
I've been using a bash for-loop for a bioinformatics project without problem until a few days ago, then it suddenly stopped working. I'm on OSX V12.1. Command: for FILE in ls *.fasta do F=$(basename "$FILE".fasta) COMMAND -f "$F".input -o "$F".output done It's a very simple for-loop, but starting three days ago, it started iterating over the file extension and giving this error: File/Path Error: No such file: 'FILE.fasta.fasta' I'm not sure what the issue is. I've tried unsetting both F and FILE, but that hasn't worked. I've done the old 'turn everything off and back on', which also didn't work. I've done my best to scour the internet for a solution, but I may be missing the correct terminology because I've come up empty.
0
0
1.3k
Aug ’22
Terminal does not receive Environment Variables
We have been trying to understand why the Mac OS Terminal, when invoked with open, does not pass along the environment variables. How to reproduce? Create a new file /tmp/example.sh #!/bin/sh echo "SAMPLE_ENV='$SAMPLE_ENV'" SAMPLE_ENV=123 open -a Terminal /tmp/example.command Only prints: SAMPLE_ENV='' Even when using SAMPLE_ENV=123 open --env SAMPLE_ENV=1234 -a Terminal /tmp/example.sh    it will only print SAMPLE_ENV='' We know for sure that this was working several years ago. Why was the feature removed or is this a bug? Any workaround? Is there a workaround on how to launch a script in a new Terminal Window while passing the environment variables correctly? Related https://stackoverflow.com/questions/69768133/react-native-envs-are-undefined-in-metro-bundlers-config-file-when-bundling/73036234
2
0
1.6k
Jul ’22
Recommendations for adding script phases to a build with SPM
Hello everyone. The project I am working on is shifting from using CocoaPods to SPM and there is one "wrinkle" I'd like some advice on. The project has several framework projects containing code as well as the main app project. All of these make use of code generators (RSwift, Sourcery) at some point and these need to be run before the main build starts. The problem is that SPM builds do not support the concept of adding script phases so there appears to be no easy way to incorporate these shell tools into the builds. Particularly in the framework projects which are pure SPM packages and therefore do not have your typical project files and build phases. My question is - how to deal with shell based build phases in an SPM world? Currently we are adding these phases in the main app's build. However they are not run before the builds of the SPM dependencies so effectively we have to run the build twice to ensure the code is up to date.
0
0
1.5k
Jun ’22
Just updated to ZSH; Messenger won't open.
I am trying to open Facebook Messenger on my app. It opens so far as I can see my contacts, but before I can see my messages it closes. Then Terminal gives me this message: Last login: Fri Dec 3 08:49:11 on ttys001 /Applications/Messenger.app/Contents/MacOS/Messenger ; exit; [myusername]@iMac ~ % /Applications/Messenger.app/Contents/MacOS/Messenger ; exit; zsh: abort /Applications/Messenger.app/Contents/MacOS/Messenger Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. [Process completed] Any suggestions how to open this app.
1
0
932
Jun ’22
Opening a new terminal window or tab is extremely slow
Working with a M1 Macbook Air, macos 12.4. Anytime I open a new terminal window or just a new tab, it takes a really long time till I can type. I have commented out my entire ~/.zshrc and when run for i in $(seq 1 10); do /usr/bin/time $SHELL -i -c exit; done directly in an open terminal window it says it finished in 0.1s. So it must be something macos is doing before zsh is even starting. PS: In the activity monitor I can only see a spike in kernel_task cpu usage when opening a new terminal
1
0
2.0k
Jun ’22
Shell Script to check password has been set to Immediately and what the screen saver time is set to
I need to create a script for checking a security posture of a machine using OPSWAT MetaAccess. They have a built-in check, however, according to them, they aren't able to check since macOS 10.13+. This seems to coordinate with a change other people have discussed on other forums where the following commands don't work anymore. OPSWAT does support checks via custom shell script and so I'm figuring out how to write that now. The scripts that don't work anymore: defaults read com.apple.screensaver idleTime defaults -currentHost read com.apple.screensaver idleTime defaults -currentHost read com.apple.screensaver askForPassword defaults read com.apple.screensaver askForPassword
0
0
971
Apr ’22
library libzstd is missing in mysql (macos monterey m1 pro)
When i compile the c program with mysql i get the next error: ld: library not found for -lzstd clang: error: linker command failed with exit code 1 (use -v to see invocation) So i use the zstd (that i installed) directory link in my command line gcc parking.o -o parking.exe `mysql_config --libs` -L/opt/homebrew/Cellar/zstd/1.5.2/lib It creates the .exe but when i launch it i get How can i solve it ? Need help please.
1
0
2.1k
Mar ’22
Build Phase scripts aren't running on XCode 13.2.1 and keeps failing
I have some shell scripts that are needed to run on the Build Phase of my iOS App, but all of then keeps getting killed when trying to run. For example with SwiftLint: /Users/vinicius/Library/Developer/Xcode/DerivedData/MyProject-somerandomstuff/Build/Intermediates.noindex/MyProject.build/Debug-iphonesimulator/MyProject.build/Script-BE4377BE84BF95B2A0F6A35B.sh: line 2: 44634 Killed: 9        "${PODS_ROOT}/SwiftLint/swiftlint" autocorrect I was thinking that could be related to some lack of permission, but I can't really identify if it really is, since it's executing the files. Do you have any idea?
0
0
948
Jan ’22
Editing my own .sh file with TextEdit sets the quarantine bit, why?
I've just bought a new MacBook Pro M1, and restored everything from my old Intel MacBook Pro using a Time Machine backup. It was a pretty smooth process, a few glitches such as needing to re-download certain apps to get the M1 version (e.g. Android Studio). One thing that I've noticed, and I don't know whether this is a Monterey thing or an M1 thing but as part of my day-to-day development work, I maintain various .sh files for building projects on different platforms. I have found that as soon as I edit and save an existing .sh file using TextEdit, it then sets the quarantine bit on the file and prevents it running from inside Zsh: zsh: operation not permitted: ./test.sh xattr yields the following: xattr ./test.sh  com.apple.TextEncoding com.apple.lastuseddate#PS com.apple.macl com.apple.metadata:kMDLabel_pjtfm5adga5rvjv2xmgkyqjwmq com.apple.quarantine This is incredibly annoying and I can't believe it is by design - this is not a file that has been downloaded from the Internet, it's my own file. Why can't I edit it using TextEdit? I do not get the same problem when I edit and save using Sublime Text, as one example, so what's with TextEdit doing that?
4
0
2.4k
Dec ’21
zsh: segmentation fault | using AHOY
Machine - MacBook Pro 13 with Apple M1 chip Hi team, Just wanted to get some help in sorting Ahoy installation on new MacBook Pro 13 with Apple M1 chip. I ran "brew install ahoy" but got a message saying "bottle not available" I have been able to build it from source and as per log below, it seems to have installed. But when I run any commands, I am getting a "zsh: segmentation fault ahoy help" error and unable to run any ahoy commands. NOTE: MacBook CONSOLE LOG added below. CONSOLE ERROR LOG - ++++++++++++++++++++++++++++++++++++++++ Process: ahoy [1840] Path: /opt/homebrew/*/ahoy Identifier: ahoy Version: ??? Code Type: X86-64 (Translated) Parent Process: zsh [1748] Responsible: Terminal [1746] User ID: 501 Date/Time: 2021-02-15 12:23:20.982 +1100 OS Version: macOS 11.2.1 (20D74) Report Version: 12 Anonymous UUID: D7AF3B6F-CFAB-F9ED-0E45-DC1AD1784827 Sleep/Wake UUID: 1689D6DE-2DD8-496C-AAC6-A6BE6699BBE9 Time Awake Since Boot: 6300 seconds Time Since Wake: 1500 seconds System Integrity Protection: enabled Crashed Thread: 0 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000018 Exception Note: EXC_CORPSE_NOTIFY Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0xb Terminating Process: exc handler [1840] VM Regions Near 0x18:- __TEXT 1000000-125f000 [ 2428K] r-x/rwx SM=COW Application Specific Information: dyld2 mode Thread 0 Crashed: 0 runtime 0x00007ffdfff70bb0 0x7ffdfff5f000 + 72624 1 0x00000000010518fd runtime.bsdthread_register + 29 2 0x00000000010295d1 runtime.schedinit + 161 Thread 1:: com.apple.rosetta.exceptionserver 0 runtime 0x00007ffdfff61238 0x7ffdfff5f000 + 8760 1 runtime 0x00007ffdfff6b354 0x7ffdfff5f000 + 50004 2 runtime 0x00007ffdfff6c1f8 0x7ffdfff5f000 + 53752 Thread 0 crashed with ARM Thread State (64-bit): x0: 0x800000010000fb90 x1: 0x00000000010518a0 x2: 0x0000000000000000 x3: 0x0000000000000000 x4: 0x0000000000000000 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x000000c42000a020 x8: 0x00007ffdfffd4a00 x9: 0x00007ffdfffd4a08 x10: 0x0000000000000000 x11: 0x00000000ffffffff x12: 0x0000000000000000 x13: 0x00000000ffffffee x14: 0x0000000000000140 x15: 0x0000000000000100 x16: 0x000000000000016e x17: 0x0000000000000000 x18: 0x800000010000fb90 x19: 0x0000000100000000 x20: 0x00000000000007ff x21: 0x0000000100014fc0 x22: 0x00000002055eaac8 x23: 0x000000000150e224 x24: 0x00000000010243b0 x25: 0x00000000013022d0 x26: 0x00000000012f8cd8 x27: 0x0000000000000000 x28: 0x00000000010518fd fp: 0x00007ffdfff70b98 lr: 0x000000000150e254 sp: 0x000000010000fb90 pc: 0x00007ffdfff70bb0 cpsr: 0x80000000 far: 0x0000000000000018 esr: 0x92000006 Binary Images: 0x1000000 - 0x125efff + (???) 0x1014d3000 - 0x10156efff dyld (832.7.3) 0D4EA85F-7E30-338B-9215-314A5A5539B6 /usr/lib/dyld 0x7ffdfff5f000 - 0x7ffdfffd2fff +runtime (203.30) C98E75A6-BDC8-3D5C-B95B-6422005E96D8 /Library/Apple/*/runtime External Modification Summary: Calls made by other processes targeting this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by all processes on this machine: task_for_pid: 4298 thread_create: 0 thread_set_state: 0 VM Region Summary: ReadOnly portion of Libraries: Total=3972K resident=0K(0%) swapped_out_or_unallocated=3972K(100%) Writable regions: Total=150.7M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=150.7M(100%) VIRTUAL REGION REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= Rosetta Arena 2048K 1 Rosetta Generic 584K 143 Rosetta IndirectBranch 32K 1 Rosetta JIT 128.0M 1 Rosetta Return Stack 20K 2 Rosetta Thread Context 20K 2 VM_ALLOCATE 528.5G 9 VM_ALLOCATE (reserved) 8K 2 reserved VM address space (unallocated) __DATA 488K 6 __DATA_CONST 32K 1 __LINKEDIT 492K 5 __TEXT 3516K 3 mapped file 4.7G 12 =========== ======= ======= TOTAL 533.3G 188 TOTAL, minus reserved VM space 533.3G 188
2
0
4.6k
Nov ’21
Paths in /etc/paths.d are not expanded. Can user home directories be supported?
Paths in /etc/paths.d are not expanded for all shells. dotnet adds a /etc/paths.d/dotnet-cli-tools file that contains ~/.dotnet/tools The ~/.dotnet/tools folder is used for tools that are 'global' across all projects for the same user. The tilde is not expanded for zsh and executables installed to ~/.dotnet/tools will not be found via the PATH. $HOME/dotnet/tools is also not expanded. (There appears to be a difference with bash. bash does seem to expand the tilde but doesn't expand variables.) The man page for path_helper says Files in these directories should contain one path element per line. The /etc/paths.d mechanism is great. Keeping installers out of a user's .profile/.zprofile/.zshrc/etc files is very helpful. But user home directory paths for the current user are not supported (at least not consistently across all shells) in the current implementation of path_helper and paths.d. Not expanding paths might be by design or by omission but adding support for paths in the current user home would be useful.
2
0
1.3k
Nov ’21
Shell Script | AWK | Variable inside FOR-Loop
Hi! I am new to OSX Shell Script and am trying to work my way into it. I don't get the expected outcome with the following snippet of my script code and I have no idea, why. I read most of the Apple Shell Script Pimer and googled a lot about it, but to no avail. I want to check the current username against some given usernames and set the value of a variable depending on the outcome. I used awk inside the shell script to get this done, but for some reason the for loop inside the awk part seems to change the value of the current username with every loop. This is the code: #!/bin/zsh awk -v u=$USER 'BEGIN {        print "Username outside loop is " u;       count[0] = "Anton";       count[1] = "Bert";       count[2] = "Carl";                                 for ( c_num in count ) {             print "Username inside loop is " u;             print "Compare to "count[c_num];                                                 if (u = count[c_num]) {                   test_var = "X";             } else {                   test_var = "Y";             }             print test_var;       } }' And this is what I get after I run it in terminal: Username outside loop is Zac Username inside loop is Zac Compare to Carl X Username inside loop is Carl Compare to Anton X Username inside loop is Anton Compare to Bert X I don't see why 'u' is changed every loop. I'm thankful for every help / advice! Markus
4
0
1.6k
Oct ’21
Is there a way to mimic a user login through terminal?
Script Example: sudo dscl . -create /Users/ITAdmin sudo dscl . -create /Users/ITAdmin UserShell /bin/bash sudo dscl . -create /Users/ITAdmin RealName ITAdmin sudo dscl . -create /Users/ITAdmin UniqueID 502 sudo dscl . -create /Users/ITAdmin PrimaryGroupID 20 sudo dscl . -create /Users/ITAdmin NFSHomeDirectory /Local/Users/ITAdmin sudo dscl . -create /Users/ITAdmin NFSHomeDirectory /Users/[ITuser] sudo dscl . -passwd /Users/ITAdmin [password] sudo dscl . -append /Groups/admin GroupMembership ITAdmin When using this locally or remotely, it works except the Home folder does not create or show up in the UI. After further testing, it does show up after an initial first time login. With our remote workforce and the secondary reasons for needing this script, we're trying to find a way to mimic a user login to add into our actual other script so that the home folder is created without actual end user interaction (won't be possible.) Or are there any other alternative ways to script a new admin user account? (Or a better place to ask this?) Thanks in advanced!
2
0
1.3k
Oct ’21
Why am I unable to remotely remove admin rights from original M1 mac admin user account?
For an IT department initiative, we have to remotely remove admin rights from a subset of M1 Macbook Air users. Their computers were set up manually with one original admin user account. After much research and testing, the admin rights removal portion of our scripting is working except for the original admin user account. A few niche online resources indicated this might possibly be due to M1's having a new type of user account called an owner. I also read that any secondary accounts after the initial one should have access to the OIK and OIC so we're confused why admin rights aren't getting removed from that original user when it works on other secondary accounts in multiple ways of testing. Any ideas or context surrounding this elusive new owner type of account, why the working script won't remove admin rights from that account but will for others, or if there's some missing info in order to accomplish this goal? We ideally would like to add an IT managed admin user and remove admin from the original user (current MDM does not support his inherently so we're getting creative.)
0
0
802
Oct ’21
Terminal merging commands within a script
My tags are Zsh and Command Line Tools I don't know if either of those apply to what is happening to me. I have a script which is all the files in my app, for each there's a code sign command in this script. I run the script, and what is happening, according to what it shows in Terminal, it is not finishing the first command, it is starting the second command in the path section of the first, first just cuts off and second begins right there, no return So naturally it finds a syntax error in the text eventually, none of the commands are run, it just prints the text of the script to screen with the commands merged as I said. If I copy the commands out of the script one by one and run them in Terminal they run each just fine. I did chmod 777 Path on the script file. I was told I have to do that to make it able to be run in Termimal. Those all there is to this. I can't run a perfectly fine script. It checks out in Text and Pages, show invisibles, there are none that are not meant to be there, only spaces and a return at the end of each command. Why would commands that work singly, not work in a script that is being run simply by dragging it to terminal, the path is typed, the hit return I am new to this area, I program in a high level language, I only know it, I don't know what most coders know about Terminal and things like privileges, and many things. I only know Omnis. Thank you. Das Goravani
1
0
780
Sep ’21
zsh for-loop erroneously expanding file extension
I've been using a bash for-loop for a bioinformatics project without problem until a few days ago, then it suddenly stopped working. I'm on OSX V12.1. Command: for FILE in ls *.fasta do F=$(basename "$FILE".fasta) COMMAND -f "$F".input -o "$F".output done It's a very simple for-loop, but starting three days ago, it started iterating over the file extension and giving this error: File/Path Error: No such file: 'FILE.fasta.fasta' I'm not sure what the issue is. I've tried unsetting both F and FILE, but that hasn't worked. I've done the old 'turn everything off and back on', which also didn't work. I've done my best to scour the internet for a solution, but I may be missing the correct terminology because I've come up empty.
Replies
0
Boosts
0
Views
1.3k
Activity
Aug ’22
Terminal does not receive Environment Variables
We have been trying to understand why the Mac OS Terminal, when invoked with open, does not pass along the environment variables. How to reproduce? Create a new file /tmp/example.sh #!/bin/sh echo "SAMPLE_ENV='$SAMPLE_ENV'" SAMPLE_ENV=123 open -a Terminal /tmp/example.command Only prints: SAMPLE_ENV='' Even when using SAMPLE_ENV=123 open --env SAMPLE_ENV=1234 -a Terminal /tmp/example.sh    it will only print SAMPLE_ENV='' We know for sure that this was working several years ago. Why was the feature removed or is this a bug? Any workaround? Is there a workaround on how to launch a script in a new Terminal Window while passing the environment variables correctly? Related https://stackoverflow.com/questions/69768133/react-native-envs-are-undefined-in-metro-bundlers-config-file-when-bundling/73036234
Replies
2
Boosts
0
Views
1.6k
Activity
Jul ’22
Recommendations for adding script phases to a build with SPM
Hello everyone. The project I am working on is shifting from using CocoaPods to SPM and there is one "wrinkle" I'd like some advice on. The project has several framework projects containing code as well as the main app project. All of these make use of code generators (RSwift, Sourcery) at some point and these need to be run before the main build starts. The problem is that SPM builds do not support the concept of adding script phases so there appears to be no easy way to incorporate these shell tools into the builds. Particularly in the framework projects which are pure SPM packages and therefore do not have your typical project files and build phases. My question is - how to deal with shell based build phases in an SPM world? Currently we are adding these phases in the main app's build. However they are not run before the builds of the SPM dependencies so effectively we have to run the build twice to ensure the code is up to date.
Replies
0
Boosts
0
Views
1.5k
Activity
Jun ’22
Just updated to ZSH; Messenger won't open.
I am trying to open Facebook Messenger on my app. It opens so far as I can see my contacts, but before I can see my messages it closes. Then Terminal gives me this message: Last login: Fri Dec 3 08:49:11 on ttys001 /Applications/Messenger.app/Contents/MacOS/Messenger ; exit; [myusername]@iMac ~ % /Applications/Messenger.app/Contents/MacOS/Messenger ; exit; zsh: abort /Applications/Messenger.app/Contents/MacOS/Messenger Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. [Process completed] Any suggestions how to open this app.
Replies
1
Boosts
0
Views
932
Activity
Jun ’22
Opening a new terminal window or tab is extremely slow
Working with a M1 Macbook Air, macos 12.4. Anytime I open a new terminal window or just a new tab, it takes a really long time till I can type. I have commented out my entire ~/.zshrc and when run for i in $(seq 1 10); do /usr/bin/time $SHELL -i -c exit; done directly in an open terminal window it says it finished in 0.1s. So it must be something macos is doing before zsh is even starting. PS: In the activity monitor I can only see a spike in kernel_task cpu usage when opening a new terminal
Replies
1
Boosts
0
Views
2.0k
Activity
Jun ’22
Shell Script to check password has been set to Immediately and what the screen saver time is set to
I need to create a script for checking a security posture of a machine using OPSWAT MetaAccess. They have a built-in check, however, according to them, they aren't able to check since macOS 10.13+. This seems to coordinate with a change other people have discussed on other forums where the following commands don't work anymore. OPSWAT does support checks via custom shell script and so I'm figuring out how to write that now. The scripts that don't work anymore: defaults read com.apple.screensaver idleTime defaults -currentHost read com.apple.screensaver idleTime defaults -currentHost read com.apple.screensaver askForPassword defaults read com.apple.screensaver askForPassword
Replies
0
Boosts
0
Views
971
Activity
Apr ’22
"You dont have permissions for /Library/Ruby/Gems/2.6.0 directory.
I have postgresql app download to Mac - Im worrking in zsh shell. Created a rails new - went to db:create or migrate &bit wont let me. now my error is ERROR: While executing gem ... (Gem::FilePermissionError) "You dont have permissions for /Library/Ruby/Gems/2.6.0 directory.
Replies
1
Boosts
0
Views
2.6k
Activity
Mar ’22
library libzstd is missing in mysql (macos monterey m1 pro)
When i compile the c program with mysql i get the next error: ld: library not found for -lzstd clang: error: linker command failed with exit code 1 (use -v to see invocation) So i use the zstd (that i installed) directory link in my command line gcc parking.o -o parking.exe `mysql_config --libs` -L/opt/homebrew/Cellar/zstd/1.5.2/lib It creates the .exe but when i launch it i get How can i solve it ? Need help please.
Replies
1
Boosts
0
Views
2.1k
Activity
Mar ’22
My ~/.zshrc Was Overwritten
I had a number of paths, aliases, customizations and such in my ZSH profile, but I opened up Terminal, today, and now the only thing in it is a path for SDKMAN. how could this have happened? can I restore my profile?
Replies
0
Boosts
0
Views
780
Activity
Feb ’22
command "dsconfigad -show" not returning any output
Whenever I am trying to run the command "dsconfigad -show", it is not returning anything. But I can see that I am connected to a domain in "enterprise connect". My Mac version is Monterey(version 12.2). Can anyone solve this issue. Thanks in advance.
Replies
0
Boosts
0
Views
984
Activity
Feb ’22
Can we control System Preferences with AppleScript?
Can we write batch scripts to configure permissions and system preferences for multiple apps on MacOS devices.
Replies
1
Boosts
0
Views
619
Activity
Jan ’22
Build Phase scripts aren't running on XCode 13.2.1 and keeps failing
I have some shell scripts that are needed to run on the Build Phase of my iOS App, but all of then keeps getting killed when trying to run. For example with SwiftLint: /Users/vinicius/Library/Developer/Xcode/DerivedData/MyProject-somerandomstuff/Build/Intermediates.noindex/MyProject.build/Debug-iphonesimulator/MyProject.build/Script-BE4377BE84BF95B2A0F6A35B.sh: line 2: 44634 Killed: 9        "${PODS_ROOT}/SwiftLint/swiftlint" autocorrect I was thinking that could be related to some lack of permission, but I can't really identify if it really is, since it's executing the files. Do you have any idea?
Replies
0
Boosts
0
Views
948
Activity
Jan ’22
Editing my own .sh file with TextEdit sets the quarantine bit, why?
I've just bought a new MacBook Pro M1, and restored everything from my old Intel MacBook Pro using a Time Machine backup. It was a pretty smooth process, a few glitches such as needing to re-download certain apps to get the M1 version (e.g. Android Studio). One thing that I've noticed, and I don't know whether this is a Monterey thing or an M1 thing but as part of my day-to-day development work, I maintain various .sh files for building projects on different platforms. I have found that as soon as I edit and save an existing .sh file using TextEdit, it then sets the quarantine bit on the file and prevents it running from inside Zsh: zsh: operation not permitted: ./test.sh xattr yields the following: xattr ./test.sh  com.apple.TextEncoding com.apple.lastuseddate#PS com.apple.macl com.apple.metadata:kMDLabel_pjtfm5adga5rvjv2xmgkyqjwmq com.apple.quarantine This is incredibly annoying and I can't believe it is by design - this is not a file that has been downloaded from the Internet, it's my own file. Why can't I edit it using TextEdit? I do not get the same problem when I edit and save using Sublime Text, as one example, so what's with TextEdit doing that?
Replies
4
Boosts
0
Views
2.4k
Activity
Dec ’21
zsh: segmentation fault | using AHOY
Machine - MacBook Pro 13 with Apple M1 chip Hi team, Just wanted to get some help in sorting Ahoy installation on new MacBook Pro 13 with Apple M1 chip. I ran "brew install ahoy" but got a message saying "bottle not available" I have been able to build it from source and as per log below, it seems to have installed. But when I run any commands, I am getting a "zsh: segmentation fault ahoy help" error and unable to run any ahoy commands. NOTE: MacBook CONSOLE LOG added below. CONSOLE ERROR LOG - ++++++++++++++++++++++++++++++++++++++++ Process: ahoy [1840] Path: /opt/homebrew/*/ahoy Identifier: ahoy Version: ??? Code Type: X86-64 (Translated) Parent Process: zsh [1748] Responsible: Terminal [1746] User ID: 501 Date/Time: 2021-02-15 12:23:20.982 +1100 OS Version: macOS 11.2.1 (20D74) Report Version: 12 Anonymous UUID: D7AF3B6F-CFAB-F9ED-0E45-DC1AD1784827 Sleep/Wake UUID: 1689D6DE-2DD8-496C-AAC6-A6BE6699BBE9 Time Awake Since Boot: 6300 seconds Time Since Wake: 1500 seconds System Integrity Protection: enabled Crashed Thread: 0 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000018 Exception Note: EXC_CORPSE_NOTIFY Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0xb Terminating Process: exc handler [1840] VM Regions Near 0x18:- __TEXT 1000000-125f000 [ 2428K] r-x/rwx SM=COW Application Specific Information: dyld2 mode Thread 0 Crashed: 0 runtime 0x00007ffdfff70bb0 0x7ffdfff5f000 + 72624 1 0x00000000010518fd runtime.bsdthread_register + 29 2 0x00000000010295d1 runtime.schedinit + 161 Thread 1:: com.apple.rosetta.exceptionserver 0 runtime 0x00007ffdfff61238 0x7ffdfff5f000 + 8760 1 runtime 0x00007ffdfff6b354 0x7ffdfff5f000 + 50004 2 runtime 0x00007ffdfff6c1f8 0x7ffdfff5f000 + 53752 Thread 0 crashed with ARM Thread State (64-bit): x0: 0x800000010000fb90 x1: 0x00000000010518a0 x2: 0x0000000000000000 x3: 0x0000000000000000 x4: 0x0000000000000000 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x000000c42000a020 x8: 0x00007ffdfffd4a00 x9: 0x00007ffdfffd4a08 x10: 0x0000000000000000 x11: 0x00000000ffffffff x12: 0x0000000000000000 x13: 0x00000000ffffffee x14: 0x0000000000000140 x15: 0x0000000000000100 x16: 0x000000000000016e x17: 0x0000000000000000 x18: 0x800000010000fb90 x19: 0x0000000100000000 x20: 0x00000000000007ff x21: 0x0000000100014fc0 x22: 0x00000002055eaac8 x23: 0x000000000150e224 x24: 0x00000000010243b0 x25: 0x00000000013022d0 x26: 0x00000000012f8cd8 x27: 0x0000000000000000 x28: 0x00000000010518fd fp: 0x00007ffdfff70b98 lr: 0x000000000150e254 sp: 0x000000010000fb90 pc: 0x00007ffdfff70bb0 cpsr: 0x80000000 far: 0x0000000000000018 esr: 0x92000006 Binary Images: 0x1000000 - 0x125efff + (???) 0x1014d3000 - 0x10156efff dyld (832.7.3) 0D4EA85F-7E30-338B-9215-314A5A5539B6 /usr/lib/dyld 0x7ffdfff5f000 - 0x7ffdfffd2fff +runtime (203.30) C98E75A6-BDC8-3D5C-B95B-6422005E96D8 /Library/Apple/*/runtime External Modification Summary: Calls made by other processes targeting this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by all processes on this machine: task_for_pid: 4298 thread_create: 0 thread_set_state: 0 VM Region Summary: ReadOnly portion of Libraries: Total=3972K resident=0K(0%) swapped_out_or_unallocated=3972K(100%) Writable regions: Total=150.7M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=150.7M(100%) VIRTUAL REGION REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= Rosetta Arena 2048K 1 Rosetta Generic 584K 143 Rosetta IndirectBranch 32K 1 Rosetta JIT 128.0M 1 Rosetta Return Stack 20K 2 Rosetta Thread Context 20K 2 VM_ALLOCATE 528.5G 9 VM_ALLOCATE (reserved) 8K 2 reserved VM address space (unallocated) __DATA 488K 6 __DATA_CONST 32K 1 __LINKEDIT 492K 5 __TEXT 3516K 3 mapped file 4.7G 12 =========== ======= ======= TOTAL 533.3G 188 TOTAL, minus reserved VM space 533.3G 188
Replies
2
Boosts
0
Views
4.6k
Activity
Nov ’21
Paths in /etc/paths.d are not expanded. Can user home directories be supported?
Paths in /etc/paths.d are not expanded for all shells. dotnet adds a /etc/paths.d/dotnet-cli-tools file that contains ~/.dotnet/tools The ~/.dotnet/tools folder is used for tools that are 'global' across all projects for the same user. The tilde is not expanded for zsh and executables installed to ~/.dotnet/tools will not be found via the PATH. $HOME/dotnet/tools is also not expanded. (There appears to be a difference with bash. bash does seem to expand the tilde but doesn't expand variables.) The man page for path_helper says Files in these directories should contain one path element per line. The /etc/paths.d mechanism is great. Keeping installers out of a user's .profile/.zprofile/.zshrc/etc files is very helpful. But user home directory paths for the current user are not supported (at least not consistently across all shells) in the current implementation of path_helper and paths.d. Not expanding paths might be by design or by omission but adding support for paths in the current user home would be useful.
Replies
2
Boosts
0
Views
1.3k
Activity
Nov ’21
Shell Script | AWK | Variable inside FOR-Loop
Hi! I am new to OSX Shell Script and am trying to work my way into it. I don't get the expected outcome with the following snippet of my script code and I have no idea, why. I read most of the Apple Shell Script Pimer and googled a lot about it, but to no avail. I want to check the current username against some given usernames and set the value of a variable depending on the outcome. I used awk inside the shell script to get this done, but for some reason the for loop inside the awk part seems to change the value of the current username with every loop. This is the code: #!/bin/zsh awk -v u=$USER 'BEGIN {        print "Username outside loop is " u;       count[0] = "Anton";       count[1] = "Bert";       count[2] = "Carl";                                 for ( c_num in count ) {             print "Username inside loop is " u;             print "Compare to "count[c_num];                                                 if (u = count[c_num]) {                   test_var = "X";             } else {                   test_var = "Y";             }             print test_var;       } }' And this is what I get after I run it in terminal: Username outside loop is Zac Username inside loop is Zac Compare to Carl X Username inside loop is Carl Compare to Anton X Username inside loop is Anton Compare to Bert X I don't see why 'u' is changed every loop. I'm thankful for every help / advice! Markus
Replies
4
Boosts
0
Views
1.6k
Activity
Oct ’21
Is there a way to mimic a user login through terminal?
Script Example: sudo dscl . -create /Users/ITAdmin sudo dscl . -create /Users/ITAdmin UserShell /bin/bash sudo dscl . -create /Users/ITAdmin RealName ITAdmin sudo dscl . -create /Users/ITAdmin UniqueID 502 sudo dscl . -create /Users/ITAdmin PrimaryGroupID 20 sudo dscl . -create /Users/ITAdmin NFSHomeDirectory /Local/Users/ITAdmin sudo dscl . -create /Users/ITAdmin NFSHomeDirectory /Users/[ITuser] sudo dscl . -passwd /Users/ITAdmin [password] sudo dscl . -append /Groups/admin GroupMembership ITAdmin When using this locally or remotely, it works except the Home folder does not create or show up in the UI. After further testing, it does show up after an initial first time login. With our remote workforce and the secondary reasons for needing this script, we're trying to find a way to mimic a user login to add into our actual other script so that the home folder is created without actual end user interaction (won't be possible.) Or are there any other alternative ways to script a new admin user account? (Or a better place to ask this?) Thanks in advanced!
Replies
2
Boosts
0
Views
1.3k
Activity
Oct ’21
Why am I unable to remotely remove admin rights from original M1 mac admin user account?
For an IT department initiative, we have to remotely remove admin rights from a subset of M1 Macbook Air users. Their computers were set up manually with one original admin user account. After much research and testing, the admin rights removal portion of our scripting is working except for the original admin user account. A few niche online resources indicated this might possibly be due to M1's having a new type of user account called an owner. I also read that any secondary accounts after the initial one should have access to the OIK and OIC so we're confused why admin rights aren't getting removed from that original user when it works on other secondary accounts in multiple ways of testing. Any ideas or context surrounding this elusive new owner type of account, why the working script won't remove admin rights from that account but will for others, or if there's some missing info in order to accomplish this goal? We ideally would like to add an IT managed admin user and remove admin from the original user (current MDM does not support his inherently so we're getting creative.)
Replies
0
Boosts
0
Views
802
Activity
Oct ’21
Using Vs code to make python package on Big Sur
I created a VENV.Even though I hardcoded in JSON files the path and deleted in the gut the path for python of my venv.still my systems default python keeps running.I am stuck I cannot get my venv python to run even though It says on vs code in the bottom that it is selected.Kindly help.
Replies
0
Boosts
0
Views
746
Activity
Oct ’21
Terminal merging commands within a script
My tags are Zsh and Command Line Tools I don't know if either of those apply to what is happening to me. I have a script which is all the files in my app, for each there's a code sign command in this script. I run the script, and what is happening, according to what it shows in Terminal, it is not finishing the first command, it is starting the second command in the path section of the first, first just cuts off and second begins right there, no return So naturally it finds a syntax error in the text eventually, none of the commands are run, it just prints the text of the script to screen with the commands merged as I said. If I copy the commands out of the script one by one and run them in Terminal they run each just fine. I did chmod 777 Path on the script file. I was told I have to do that to make it able to be run in Termimal. Those all there is to this. I can't run a perfectly fine script. It checks out in Text and Pages, show invisibles, there are none that are not meant to be there, only spaces and a return at the end of each command. Why would commands that work singly, not work in a script that is being run simply by dragging it to terminal, the path is typed, the hit return I am new to this area, I program in a high level language, I only know it, I don't know what most coders know about Terminal and things like privileges, and many things. I only know Omnis. Thank you. Das Goravani
Replies
1
Boosts
0
Views
780
Activity
Sep ’21