Scripting

RSS for tag

Scripting allows you to automate complex, repetitive, and time-consuming tasks by writing scripts that interact with apps, processes, and the operating system.

Posts under Scripting tag

95 Posts

Post

Replies

Boosts

Views

Activity

applescript script stopped working after 12.0.1 (Monterey) upgrade
I have simple script to turn down the brightness of my MacBook Pro via an AppleScript. This worked fine in BigSur, but has stopped working after I upgraded to Monterey 12.0.1. The script is as follows: tell application "System Preferences" reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays" end tell tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display" set value of value indicator 1 of slider 1 of tab group 1 to 0.0 end tell ..error is as follows in script editor: error "System Events got an error: Can’t set window \"Built-in Retina Display\" of process \"System Preferences\" to 0.0." number -10006 from window "Built-in Retina Display" of process "System Preferences" Any suggestions on what to modify to get it working again?
7
0
5.6k
Oct ’22
Xcode Cloud - build release notes
Hello, I'm fairly new to the Xcode Cloud workflow and I would like to know, is there a way to automatically include release notes to a build after it's been uploaded? I can for example set up a Fastlane script that will gather changes since the last build (from git history) and put them in a file on the repository. But is there a way to upload the notes after the build is uploaded to TestFlight?
1
8
2.1k
Oct ’22
How to enter device passcode in wireless test automation
-How to enter device passcode in wireless test automationI am using XCTest to run a test with Xcode wireless debugging feature turned on. Setting up wireless debugging needs passcode enabled on iPhoneIn the test, it will lock the screen in the middle of workflow. When unlocking the screen, it asks for a device passcode. But I could not find a way to enter device passcode. Since at this moment, XCUIApplication could not find any element on the passcode screen.Can anyone know:What Bundle ID is the passcode screen? OrHow to type or enter device passcode using automation?
2
0
3.2k
Oct ’22
creating a custom keyboard shortcut to toggle accessibility item “Speak items under the pointer” on/off
Disclaimer: I'm not a developer, so please bear with me! I’m looking for the best way to create a custom keyboard shortcut for apple’s accessibility setting to toggle “Speak items under the pointer” on/off. From my research, it’s my understanding that you can use Apple’s ‘Automator’ or ‘Shortcuts’ app. I see both a “Run AppleScript” option and “Run JavaScript for Mac Automation”. Might anyone be able to provide me with a copy and paste script which can create this keyboard shortcut? (Suggestions on the best way to do this/app to use and non-developer friendly instructions would also be greatly appreciated! 😂) Thank you in advance! (If needed, I'm running Monterey 12.6 on a MacBook Pro with an M1 chip)
1
0
991
Sep ’22
MacOS 12.3 - Python - Missing NSWorkspace from AppKit
In the past I used this script as groundwork for a little helper which swaps the Modifier Keys (CMD, OPT, CTRL) for me, when a specific application getting focused and unfocused. With MacOS 12.3 Apple finally removed Python2 Not a big deal, if you reinstall it via Homebrew and update all your Python scripts. But what is about Apple related modules like NSWorkspace from AppKit? Code: try: from AppKit import NSWorkspace except ImportError: print "Can't import AppKit -- maybe you're running python from brew?" print "Try running with Apple's /usr/bin/python instead." exit(1) This code returns reasonably the print-message. Question Is this not available anymore? Because the homebrew version can't find this and Python3 seems also not to know it. Is NSWorkspace for Python now deprecated?
2
0
3.9k
Sep ’22
Simple and Fast IPC mechanism between two shell scripts
I have two shell applications and one starts to run after the other exits. I need to set a flag from the first shell application. From the second shell application, I need to check whether the flag is true or false. What is the simplest way to do it? As they don't run simultaneously I can't use named pipes. Writing to a file seems complicated. What are some other mechanisms to achieve this?
0
0
1.1k
Sep ’22
How do I programmatically invoke Startup Manager at subsequent boot?
As "https://sourceforge.net/p/refind/discussion/general/thread/05965d36c2/#d8df" partially describes, I am attempting to programmatically invoke Startup Manager at subsequent boot, and ideally reboot immediately subsequently. This is similar to what "http://github.com/OpenRC/openrc/issues/539#issue-1324331600" describes performs, but ideally I'd like a way to be able to set macOS to invoke the Startup Manager without needing to force a reboot immediately, because I can always invoke manually reinitialize the device by invoking “reboot”, obviously. I, as is true for most, am unable to observe the macOS source-code, so I obviously am unable to emulate how macOS performs this. However, I am additionally unable to locate any relevant documentation. I am thankful for any assistance.
1
1
1.9k
Sep ’22
Multiprocessing in Python on NPU
Hi, I am doing multiprocessing currently in python and need to upgrade my laptop. The scientific computing I am doing which usually takes awhile so I'd like to have as many cores as I can get. The question: How, if possible, might I use the NPU instead of (or in tandem with) the CPU for multiprocessing? In python it is fairly straight forward with the concurrent futures package, https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor .
0
0
1.2k
Aug ’22
Automation text message if statements
I want an automation that will use an if statement with receiving text messages. if I receive a certain response, then I want it to send a new message. Is there a way to use an if statement for this? Or to nest automations? Because I can create an automation that will do this, but I need it to exist within another automation. Here is what I want if I am not being clear. at a certain time, automation will send message one. if I receive the desired response, it will send message two. if I do not receive the desired response, automation will wait and then send another message.
0
0
1.9k
Aug ’22
How to search a ~500Gb file for a series of hex values and output the results to a text file?
Hi, I'm a bit new to using Macs, and I'm trying to do something that I'd normally do in powershell. I have a series of hex values that I wish to search for in a particularly large binary file. For each result I would like: The location of the result in the file The surrounding data represented as both hex and string I guess sort of like what you'd see if you searched for a hex value in "Hex Fiend" but I need to put it into a script as there are around ~500 values I need to search for. It was suggested that I try Grep, but it's only returning the location of the result and I need to see (at a glance) what is in the location rather than navigating manually to each result location. Any ideas? :)
0
0
1.1k
Aug ’22
Automate the Install of Xcode Command Line Tools
Does anyone know how to automate the install of Xcode Command Line Tools? Bonus points for doing it in a supportable Apple method, and if possible, leveraging the macOS version of Bash I've tried this method: (sorry, this forum won't allow the link) xcode-select --install sleep 1 osascript <<EOD tell application "System Events" tell process "Install Command Line Developer Tools" keystroke return click button "Agree" of window "License Agreement" end tell end tell EOD This automation fails because on first-run, the Security & Privacy wants (user) approval for: Accessibility > sshd-keygen-wrapper: annoying (bottom) This approval must be provided before the install but there is no way to manually approve before the install, nor automate the approval during the install At least not as far as far as I can see. Any help is appreciated. TIA
2
0
6.8k
Aug ’22
NSAppleEventsUsageDescription entitlement without a development certificate for local use
I am trying to build a macOS application that invokes NSAppleScript that controls Safari, but in order to do so, I need the NSAppleEventsUsageDescription entitlement set. However, this entitlement requires, from my understanding, a paid developer account for the signing certificate (free provisioned certificates don't appear to be able to work). I only want to be able to run this application locally for personal use. Here are some less than ideal options I've considered: Invoking NSUserAppleScriptTask instead and creating custom script files Running the generated application binary directly from Terminal which supports these entitlements Using SafariServices (however when I tried doing so, functions like getAllWindows would not seem to fire but this is a separate issue) Code signing with a self generated local root certificate (this did not work) Buying into the paid developer programme (I'd rather not) Are there any other options? I am on macOS Monterey 12.4 and using Xcode 13.4.1.
2
0
2.0k
Jul ’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
Unable to install pkg with both architectures via Intune Line-of-Business (LOB) app
We have a project that compiles an app for both x64 and arm64 Mac machines. This build is done via Visual Studio MSBuild with specific RIDs and Mac native code via xcode. Using the 'packages' application we build an distribution package, which contains the two pkgs for the specific architectures. The project contains settings to pick the correct PKG according to the architecture running the installation ('packages' will include a JavaScript script in the Distribution file for this). This all works just fine when running the final PKG manually. But when deploying via Intune as LOB this doesn't work well. It seems Intune will skip the complete Distribution file and will install all the PKGs included in to distribution package. The logfile shows that both x64 and arm64 are installed Install.log This will result in the x64 to be installed, and being overwritten by the arm64 installation. And a non-functional app on a x64 based Mac. We edited the preinstall.sh for both packages and do another architecture check and error-out when running on a wrong platform; but that doesn't work either: Intune will cancel the whole installation transaction when one pkg fails. Resulting in a non-installed package. What would be a good way to create an universal installation/distribution package with both architectures which would be able to be deployed via intune?
0
0
1.5k
Jul ’22
xcodebuild -updatePackageDependencies
We've been looking for a while for a solution to updating package dependencies from the command line. Does Xcode 14 provide a way to do it? I've been searching and haven't seen anything. Anyone saw something? We've had xcodebuild -resolvePackageDependencies for a while, but as many people point out here and in Stack Overflow, this option does not actually update the dependencies like the Update to Latest Package Versions menu command does in Xcode. The goal is to have an automated way to keep dependencies up-to-date, so we can run a script nightly that produces a PR which someone on the team can verify before merging.
0
2
1.2k
Jun ’22
System Events on XCode error 1743
Hi guys,someone else has encountered this error with XCode 10 and Mojave? A simple fragment of code, that works fine on applescript, fail during the compilation on XCode with the error "Not authorized to send Apple Events to System Events. (error -1743).on applicationWillFinishLaunching_(aNotification) tell application "System Events" -- any fragment of code that comes to mind tell appearance preferences set dark mode to not dark mode end tell end tell end applicationWillFinishLaunching_ I have searched in google but I have not found anything,thanks for help
10
0
12k
Jun ’22
Automating 3rd party app without access to source code
Hello,I have unique requirement where i want to use automation frameworks such as XCUITest etc. to be able to automate 3rd party apps. I know that the XCode 8 now has native support however so far from what i can tell it only works if you have access to source code?In my case the app is available as a binary and there is no source code access available/possible? In this case any recommendations how Ui based autoamtion can be built and used?Previoulsy i was able to use UiAutomation framework but that has been depcreated in latest XCode. In the new XCUITest framework I havent been able to sort out how to target a 3rd party app installed on the iPhone and automate that.Any help would be appreciated.Thanks
4
0
3.5k
Jun ’22
False "xcodebuild archive" fail on bamboo/ Monterey/ m1 chip/ Xcode 13.2.1
This is so strange I'm at a loss. Background: I am a DevOps engineer validating that our iOS build scripts can run via Bamboo on new Mac mini M1 machines. Out of the box, these machines are running Monterey, while our in-use machines are all still on Big Sur. Tldr; After modifying security permissions for our custom CI keychain so it's accessible by Xcode's CLI tools (specifically, the codesign and security utilities) the "xcodebuild archive" command we run fails with NO logged errors, causing bamboo to fail the build. However, the "failed" command produces a VALID xcarchive file. If I force the archive step to exit with a zero status, the subsequent "xcodebuild exportArchive" step successfully generates a valid .ipa that can be submitted to Testflight and run as expected. I've never seen anything like this. Details: Initially, our builds were failing with codesigning errors related to the CLI tools interacting with our custom keychain (we use a custom keychain so Bamboo only has access to the codesigning assets it needs, this is best practice, at least up til now.) We could build on the new Mac mini with Xcode IDE just fine, and we could even build from the commandline on the new Mac mini. However, running the same commands via ssh to the new Mac mini from my local machine produced the same error bamboo was getting. We were getting errors like this: 23-Mar-2022 13:35:58 Warning: unable to build chain to self-signed root for signer "Apple Development: Elizabeth Goldstein (XXXXXXX)" 23-Mar-2022 13:35:58 /Users/bamboo/agent-home/xml-data/build-dir/path/to/Build/Products/QA-iphoneos/Shared.framework: errSecInternalComponent 23-Mar-2022 13:35:58 Command CodeSign failed with a nonzero exit code We were already unlocking the keychain as part of the build script, and the private key was set to "Allow all access" for outside applications (two common issues that might raise this error.) Finally, I rebuilt the system keychain by first deleting then manually re-importing Apple's root signing certificates from terminal like this: sudo security import ./AppleWWDRCA.cer -k /Library/Keychains/System.keychain -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild sudo security import ./AppleWWDRCAG3.cer -k /Library/Keychains/System.keychain -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild Then I deleted and re-imported my company's signing assets into our custom keychain like this: security import ./appstore-cert.p12 -k /Users/bamboo/Library/Keychains/our-ci.keychain-db -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild security import ./dev-cert.p12 -k /Users/bamboo/Library/Keychains/our-ci.keychain-db -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild So now, there are zero errors in the log that I can find, but bamboo still fails when we run these commands: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace OUR-APP.xcworkspace -scheme iPhoneApp-QA clean build -configuration QA -derivedDataPath output -sdk iphoneos OTHER_CFLAGS="-fembed-bitcode" ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace OUR-APP.xcworkspace -scheme iPhoneApp-QA -sdk iphoneos -configuration QA -derivedDataPath output archive -archivePath build.xcarchive OTHER_CFLAGS="-fembed-bitcode" ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode If I change it to /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace OUR-APP.xcworkspace -scheme iPhoneApp-QA -sdk iphoneos -configuration QA -derivedDataPath output archive -archivePath build.xcarchive OTHER_CFLAGS="-fembed-bitcode" ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode || exit 0 The final exportArchive command generates a valid .ipa Any help or ideas would be greatly appreciated, since of course that's not a viable workaround, nor is pinning our OS to Big Sur forever, and we need to scale up our CI system. Thank you for reading this far!
3
0
3.3k
May ’22
Applescript to get title from Keynote slide
I am trying to get the title of the slides.  But it is not working with apple script, can anyone please help me with this? This is the code I have written in AppleScript. tell application "Keynote" activate tell the first slide set slideone to first slide of document 1 set mytitlename to title of slideone end tell end tell
Replies
1
Boosts
0
Views
1.6k
Activity
Nov ’22
applescript script stopped working after 12.0.1 (Monterey) upgrade
I have simple script to turn down the brightness of my MacBook Pro via an AppleScript. This worked fine in BigSur, but has stopped working after I upgraded to Monterey 12.0.1. The script is as follows: tell application "System Preferences" reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays" end tell tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display" set value of value indicator 1 of slider 1 of tab group 1 to 0.0 end tell ..error is as follows in script editor: error "System Events got an error: Can’t set window \"Built-in Retina Display\" of process \"System Preferences\" to 0.0." number -10006 from window "Built-in Retina Display" of process "System Preferences" Any suggestions on what to modify to get it working again?
Replies
7
Boosts
0
Views
5.6k
Activity
Oct ’22
Xcode Cloud - build release notes
Hello, I'm fairly new to the Xcode Cloud workflow and I would like to know, is there a way to automatically include release notes to a build after it's been uploaded? I can for example set up a Fastlane script that will gather changes since the last build (from git history) and put them in a file on the repository. But is there a way to upload the notes after the build is uploaded to TestFlight?
Replies
1
Boosts
8
Views
2.1k
Activity
Oct ’22
How to enter device passcode in wireless test automation
-How to enter device passcode in wireless test automationI am using XCTest to run a test with Xcode wireless debugging feature turned on. Setting up wireless debugging needs passcode enabled on iPhoneIn the test, it will lock the screen in the middle of workflow. When unlocking the screen, it asks for a device passcode. But I could not find a way to enter device passcode. Since at this moment, XCUIApplication could not find any element on the passcode screen.Can anyone know:What Bundle ID is the passcode screen? OrHow to type or enter device passcode using automation?
Replies
2
Boosts
0
Views
3.2k
Activity
Oct ’22
creating a custom keyboard shortcut to toggle accessibility item “Speak items under the pointer” on/off
Disclaimer: I'm not a developer, so please bear with me! I’m looking for the best way to create a custom keyboard shortcut for apple’s accessibility setting to toggle “Speak items under the pointer” on/off. From my research, it’s my understanding that you can use Apple’s ‘Automator’ or ‘Shortcuts’ app. I see both a “Run AppleScript” option and “Run JavaScript for Mac Automation”. Might anyone be able to provide me with a copy and paste script which can create this keyboard shortcut? (Suggestions on the best way to do this/app to use and non-developer friendly instructions would also be greatly appreciated! 😂) Thank you in advance! (If needed, I'm running Monterey 12.6 on a MacBook Pro with an M1 chip)
Replies
1
Boosts
0
Views
991
Activity
Sep ’22
MacOS 12.3 - Python - Missing NSWorkspace from AppKit
In the past I used this script as groundwork for a little helper which swaps the Modifier Keys (CMD, OPT, CTRL) for me, when a specific application getting focused and unfocused. With MacOS 12.3 Apple finally removed Python2 Not a big deal, if you reinstall it via Homebrew and update all your Python scripts. But what is about Apple related modules like NSWorkspace from AppKit? Code: try: from AppKit import NSWorkspace except ImportError: print "Can't import AppKit -- maybe you're running python from brew?" print "Try running with Apple's /usr/bin/python instead." exit(1) This code returns reasonably the print-message. Question Is this not available anymore? Because the homebrew version can't find this and Python3 seems also not to know it. Is NSWorkspace for Python now deprecated?
Replies
2
Boosts
0
Views
3.9k
Activity
Sep ’22
Simple and Fast IPC mechanism between two shell scripts
I have two shell applications and one starts to run after the other exits. I need to set a flag from the first shell application. From the second shell application, I need to check whether the flag is true or false. What is the simplest way to do it? As they don't run simultaneously I can't use named pipes. Writing to a file seems complicated. What are some other mechanisms to achieve this?
Replies
0
Boosts
0
Views
1.1k
Activity
Sep ’22
How do I programmatically invoke Startup Manager at subsequent boot?
As "https://sourceforge.net/p/refind/discussion/general/thread/05965d36c2/#d8df" partially describes, I am attempting to programmatically invoke Startup Manager at subsequent boot, and ideally reboot immediately subsequently. This is similar to what "http://github.com/OpenRC/openrc/issues/539#issue-1324331600" describes performs, but ideally I'd like a way to be able to set macOS to invoke the Startup Manager without needing to force a reboot immediately, because I can always invoke manually reinitialize the device by invoking “reboot”, obviously. I, as is true for most, am unable to observe the macOS source-code, so I obviously am unable to emulate how macOS performs this. However, I am additionally unable to locate any relevant documentation. I am thankful for any assistance.
Replies
1
Boosts
1
Views
1.9k
Activity
Sep ’22
Multiprocessing in Python on NPU
Hi, I am doing multiprocessing currently in python and need to upgrade my laptop. The scientific computing I am doing which usually takes awhile so I'd like to have as many cores as I can get. The question: How, if possible, might I use the NPU instead of (or in tandem with) the CPU for multiprocessing? In python it is fairly straight forward with the concurrent futures package, https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor .
Replies
0
Boosts
0
Views
1.2k
Activity
Aug ’22
Automation text message if statements
I want an automation that will use an if statement with receiving text messages. if I receive a certain response, then I want it to send a new message. Is there a way to use an if statement for this? Or to nest automations? Because I can create an automation that will do this, but I need it to exist within another automation. Here is what I want if I am not being clear. at a certain time, automation will send message one. if I receive the desired response, it will send message two. if I do not receive the desired response, automation will wait and then send another message.
Replies
0
Boosts
0
Views
1.9k
Activity
Aug ’22
How to search a ~500Gb file for a series of hex values and output the results to a text file?
Hi, I'm a bit new to using Macs, and I'm trying to do something that I'd normally do in powershell. I have a series of hex values that I wish to search for in a particularly large binary file. For each result I would like: The location of the result in the file The surrounding data represented as both hex and string I guess sort of like what you'd see if you searched for a hex value in "Hex Fiend" but I need to put it into a script as there are around ~500 values I need to search for. It was suggested that I try Grep, but it's only returning the location of the result and I need to see (at a glance) what is in the location rather than navigating manually to each result location. Any ideas? :)
Replies
0
Boosts
0
Views
1.1k
Activity
Aug ’22
Automate the Install of Xcode Command Line Tools
Does anyone know how to automate the install of Xcode Command Line Tools? Bonus points for doing it in a supportable Apple method, and if possible, leveraging the macOS version of Bash I've tried this method: (sorry, this forum won't allow the link) xcode-select --install sleep 1 osascript <<EOD tell application "System Events" tell process "Install Command Line Developer Tools" keystroke return click button "Agree" of window "License Agreement" end tell end tell EOD This automation fails because on first-run, the Security & Privacy wants (user) approval for: Accessibility > sshd-keygen-wrapper: annoying (bottom) This approval must be provided before the install but there is no way to manually approve before the install, nor automate the approval during the install At least not as far as far as I can see. Any help is appreciated. TIA
Replies
2
Boosts
0
Views
6.8k
Activity
Aug ’22
NSAppleEventsUsageDescription entitlement without a development certificate for local use
I am trying to build a macOS application that invokes NSAppleScript that controls Safari, but in order to do so, I need the NSAppleEventsUsageDescription entitlement set. However, this entitlement requires, from my understanding, a paid developer account for the signing certificate (free provisioned certificates don't appear to be able to work). I only want to be able to run this application locally for personal use. Here are some less than ideal options I've considered: Invoking NSUserAppleScriptTask instead and creating custom script files Running the generated application binary directly from Terminal which supports these entitlements Using SafariServices (however when I tried doing so, functions like getAllWindows would not seem to fire but this is a separate issue) Code signing with a self generated local root certificate (this did not work) Buying into the paid developer programme (I'd rather not) Are there any other options? I am on macOS Monterey 12.4 and using Xcode 13.4.1.
Replies
2
Boosts
0
Views
2.0k
Activity
Jul ’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
Unable to install pkg with both architectures via Intune Line-of-Business (LOB) app
We have a project that compiles an app for both x64 and arm64 Mac machines. This build is done via Visual Studio MSBuild with specific RIDs and Mac native code via xcode. Using the 'packages' application we build an distribution package, which contains the two pkgs for the specific architectures. The project contains settings to pick the correct PKG according to the architecture running the installation ('packages' will include a JavaScript script in the Distribution file for this). This all works just fine when running the final PKG manually. But when deploying via Intune as LOB this doesn't work well. It seems Intune will skip the complete Distribution file and will install all the PKGs included in to distribution package. The logfile shows that both x64 and arm64 are installed Install.log This will result in the x64 to be installed, and being overwritten by the arm64 installation. And a non-functional app on a x64 based Mac. We edited the preinstall.sh for both packages and do another architecture check and error-out when running on a wrong platform; but that doesn't work either: Intune will cancel the whole installation transaction when one pkg fails. Resulting in a non-installed package. What would be a good way to create an universal installation/distribution package with both architectures which would be able to be deployed via intune?
Replies
0
Boosts
0
Views
1.5k
Activity
Jul ’22
xcodebuild -updatePackageDependencies
We've been looking for a while for a solution to updating package dependencies from the command line. Does Xcode 14 provide a way to do it? I've been searching and haven't seen anything. Anyone saw something? We've had xcodebuild -resolvePackageDependencies for a while, but as many people point out here and in Stack Overflow, this option does not actually update the dependencies like the Update to Latest Package Versions menu command does in Xcode. The goal is to have an automated way to keep dependencies up-to-date, so we can run a script nightly that produces a PR which someone on the team can verify before merging.
Replies
0
Boosts
2
Views
1.2k
Activity
Jun ’22
System Events on XCode error 1743
Hi guys,someone else has encountered this error with XCode 10 and Mojave? A simple fragment of code, that works fine on applescript, fail during the compilation on XCode with the error "Not authorized to send Apple Events to System Events. (error -1743).on applicationWillFinishLaunching_(aNotification) tell application "System Events" -- any fragment of code that comes to mind tell appearance preferences set dark mode to not dark mode end tell end tell end applicationWillFinishLaunching_ I have searched in google but I have not found anything,thanks for help
Replies
10
Boosts
0
Views
12k
Activity
Jun ’22
Automating 3rd party app without access to source code
Hello,I have unique requirement where i want to use automation frameworks such as XCUITest etc. to be able to automate 3rd party apps. I know that the XCode 8 now has native support however so far from what i can tell it only works if you have access to source code?In my case the app is available as a binary and there is no source code access available/possible? In this case any recommendations how Ui based autoamtion can be built and used?Previoulsy i was able to use UiAutomation framework but that has been depcreated in latest XCode. In the new XCUITest framework I havent been able to sort out how to target a 3rd party app installed on the iPhone and automate that.Any help would be appreciated.Thanks
Replies
4
Boosts
0
Views
3.5k
Activity
Jun ’22
Any documentation on XCUITest???
Has anyone been able to find any documentation on XCUITest? I haven't had much success with it. I've watched the video a few times and it doesn't work as easily as is shown. I can't find any other sources of documentation other than reading the few comments in a couple of header files. I'm so frustrated...
Replies
4
Boosts
0
Views
2.6k
Activity
Jun ’22
False "xcodebuild archive" fail on bamboo/ Monterey/ m1 chip/ Xcode 13.2.1
This is so strange I'm at a loss. Background: I am a DevOps engineer validating that our iOS build scripts can run via Bamboo on new Mac mini M1 machines. Out of the box, these machines are running Monterey, while our in-use machines are all still on Big Sur. Tldr; After modifying security permissions for our custom CI keychain so it's accessible by Xcode's CLI tools (specifically, the codesign and security utilities) the "xcodebuild archive" command we run fails with NO logged errors, causing bamboo to fail the build. However, the "failed" command produces a VALID xcarchive file. If I force the archive step to exit with a zero status, the subsequent "xcodebuild exportArchive" step successfully generates a valid .ipa that can be submitted to Testflight and run as expected. I've never seen anything like this. Details: Initially, our builds were failing with codesigning errors related to the CLI tools interacting with our custom keychain (we use a custom keychain so Bamboo only has access to the codesigning assets it needs, this is best practice, at least up til now.) We could build on the new Mac mini with Xcode IDE just fine, and we could even build from the commandline on the new Mac mini. However, running the same commands via ssh to the new Mac mini from my local machine produced the same error bamboo was getting. We were getting errors like this: 23-Mar-2022 13:35:58 Warning: unable to build chain to self-signed root for signer "Apple Development: Elizabeth Goldstein (XXXXXXX)" 23-Mar-2022 13:35:58 /Users/bamboo/agent-home/xml-data/build-dir/path/to/Build/Products/QA-iphoneos/Shared.framework: errSecInternalComponent 23-Mar-2022 13:35:58 Command CodeSign failed with a nonzero exit code We were already unlocking the keychain as part of the build script, and the private key was set to "Allow all access" for outside applications (two common issues that might raise this error.) Finally, I rebuilt the system keychain by first deleting then manually re-importing Apple's root signing certificates from terminal like this: sudo security import ./AppleWWDRCA.cer -k /Library/Keychains/System.keychain -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild sudo security import ./AppleWWDRCAG3.cer -k /Library/Keychains/System.keychain -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild Then I deleted and re-imported my company's signing assets into our custom keychain like this: security import ./appstore-cert.p12 -k /Users/bamboo/Library/Keychains/our-ci.keychain-db -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild security import ./dev-cert.p12 -k /Users/bamboo/Library/Keychains/our-ci.keychain-db -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild So now, there are zero errors in the log that I can find, but bamboo still fails when we run these commands: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace OUR-APP.xcworkspace -scheme iPhoneApp-QA clean build -configuration QA -derivedDataPath output -sdk iphoneos OTHER_CFLAGS="-fembed-bitcode" ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace OUR-APP.xcworkspace -scheme iPhoneApp-QA -sdk iphoneos -configuration QA -derivedDataPath output archive -archivePath build.xcarchive OTHER_CFLAGS="-fembed-bitcode" ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode If I change it to /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace OUR-APP.xcworkspace -scheme iPhoneApp-QA -sdk iphoneos -configuration QA -derivedDataPath output archive -archivePath build.xcarchive OTHER_CFLAGS="-fembed-bitcode" ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode || exit 0 The final exportArchive command generates a valid .ipa Any help or ideas would be greatly appreciated, since of course that's not a viable workaround, nor is pinning our OS to Big Sur forever, and we need to scale up our CI system. Thank you for reading this far!
Replies
3
Boosts
0
Views
3.3k
Activity
May ’22