How to launch .app through Terminal? - xcode

For installing the .app file using Terminal I followed the steps provided here https://stackoverflow.com/a/27313079 .
It worked fine but when I try to launch, the application gets crashed. I followed few suggestions mentioned here Failed to Attach to Process ID Xcode but nothing worked for me so far. Your help is appreciated.

Well, head over to Terminal, (assuming you have Xcode command line tools installed)
But first, launch iPhone Simulator.
Then type xcrun simctl install booted /foo/bar.app into the Terminal,
Where /foo/bar.app is of course, your app.
Then wait a couple seconds.
After it completes, head over to the app's Info.plist file and find the line that says bundle identifier. Next to it is the bundle identifier, which should look like this: com.foo.bar or the like.
Then go to Terminal again and type xcrun simctl launch booted com.foo.bar, Where com.foo.bar is your app identifier.

Related

programmatically xcode build(ios library) -is it possible?

I have mac descktop app(flutter, small obfuscator for objective-c code). after obfuscation of the source code, the user builds a ios library in XCode. is it possible to start the build process from my application?
These my options are:
Xcode Command Line Tools - it's very similar, but looks a bit complicated.
Also, I don't know yet how to use the terminal (terminal commands) in the desktop application - is it even possible?
fastlane -this tool is more for deployment. can i use this to build locally?
What do you recommend? maybe there are other options?
read below documentaion and set flutter path so it can be runable in terminal or you can get help from youtube to set flutter path
then simply open terminal and run below comands one by one
1.open -a simulator
this command open ios emulator
write cd and drag your project folder path
cd .../example
flutter run
✅your app launch in emulator
flutter path set details
https://docs.flutter.dev/get-started/install/macos

XCode - How to reset/"delete" a mac os app run from Xcode (analog to deleting the app in the ios simulator)?

When using the iOS Simulator, I can simply delete the app and re-run the app to start fresh. How is this done for mac os apps? I can't find it out. There is a folder for the project inside "DerivedData", but deleting this also messes with the entire project and I have to re-fetch all dependencies and stuff.
Thanks!
Had the same question, found the answer in another question on Stack Overflow: Nicolas Miari and superfell's answer did the trick for me and my Mac Catalyst app:
You can use the defaults command line tool to remove all the settings,
you just need the bundle id of your app (which you can find in your
Info.plist file), e.g. if your bundle id is "com.foo.barApp" then you
can run this from a terminal shell:
defaults delete com.foo.barApp
For anyone who comes here later for solution:
install fd from homebrew: brew install fd
search for your data folder: fd com.thisIsYour.bundleId
You should see something likes this:
Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD/Data/Library/...
Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD/Data/Library/...
Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD/Data/Library/...
remove the folder: rm -rf Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD
If the app is storing something at say ~/Library/Caches/yourapp or ~/Library/Application Support/yourapp, it's trivial to set up an Automator Service, or bash alias to clean them up.
~/Library/Developer/Xcode/DerivedData is meant for the Xcode project and the things Xcode creates, not the things that your app creates such as user preferences.
Alternatively, you can create a listener for a flag in the app itself like --run-fresh that can be set in scheme settings as launch argument. This flag will (if you code it) stop the app from looking into user data folder.

Unable to open LiClipse 6.1.0 on MacOS/Catalina (10.15.3)

I have downloaded LiClipse 6.1.0 from http://www.liclipse.com/download.html three times (to ensure that I don't have a corrupt/damaged file) and installed it on a MacPro Notebook with MacOS Catalina (10.15.3). I have followed the installation instructions at http://www.liclipse.com/download.html for Native Mac OS Install, but every time I get "“LiClipse.app” is damaged and can’t be opened. You should move it to the Trash."
Since it gets installed without any problem, I think that downloaded file is not corrupted/damaged, but when opening it I always get the warning about its being damaged even when I have run sudo spctl --master-disable to enable apps from "Anywhere" to run.
I would appreciate if anyone who had succeeded in opening it on a MacPro/Catalina would share his/her steps. Thanks.
You can try removing the quarantine flag (when Mac downloads a file it marks it as quarantined and it won't run unless it has an Apple signature -- which LiClipse doesn't have, so, Apple is making it always a bit harder to run files you download).
To remove the quarantine flag, run:
xattr -d com.apple.quarantine <FILE>
(<FILE> being /Applications/LiClipse.app and maybe /Applications/LiClipse.app/MacOS/LiClipse too -- I don't really have Catalina to check).

Xcode won't start, stuck on 'Verifying "Xcode"...'

I've installed Xcode on a mac and when I try to start it I get a little window open saying 'Verifying Xcode' with a status bar scrolling across, anyone got a fix rather than reinstalling?
If you don't want to wait forever, this might help:
xattr -d com.apple.quarantine '/Applications/Xcode.app'
Running a command to get through Gatekeeper sounds like the way to go, since you downloaded it from a trusted source. This is a common occurrence when installing large bundles in Mac OS X. Basically, Gatekeeper examines your entire bundle, making sure that there is no suspicious code. This is one of the many things that keeps Mac OS X as secure as it is. You have two options:
1: Give it time.
Or,
2: Manually tell Gatekeeper "It's okay, this is from a trusted source". How do we do this? Well, first fire up the Terminal and navigate to your Xcode.app folder. (Or type in cd and drag-and-drop Xcode from your applications folder), then hit enter.
Next, run the command:
xattr -d com.apple.quarantine Xcode.app
Now, be careful getting past Gatekeeper if whatever you are installing is even slightly from an untrusted source, or else you introduce a security risk to your computer. In my case, opening new versions of Xcode quickly is the only time I will ever run that command.
anyone got a fix rather than me reinstalling?
For anyone else seeing a very long "Verifying Xcode" phase, just give it time. The indeterminate progress bar stays up there for a long time (tens of minutes) while Gatekeeper looks at the (very large) Xcode bundle to make sure that it's legit. Eventually, you'll get the familiar message along the lines of "This application was downloaded from the Internet. Do you want to continue?" Or, if the bundle doesn't check out, you'll of course get a message to that effect.
Almost every answer here recommends running xattr -d on the file. This deletes the file's extended attributes (like com.apple.quarantine) so OSX will not run the verification phase. You should only do this as an absolute last resort if at all. Apple explicitly recommends leaving Gatekeeper enabled to validate your version of Xcode after XcodeGhost malware was spread to popular iOS apps via infected versions of Xcode.
If you're stuck trying unarchive an Xcode beta .xip archive, try this:
Open the Archive Utility app. (Open Finder by hitting ⌘+spacebar and type "Archive Utility")
Choose File->Expand Archive and select the Xcode archive.
I had same issue. Quick fix is to open terminal from application or type terminal in spotlight and enter below command.
cd /Applications - This will move to applications directory where Xcode is present
xattr -d com.apple.quarantine Xcode.app - This will bypass Gatekeeper in OS X and will launch Xcode quickly
Note: If you have changed name of Xcode (say Xcode7-1) then you should enter ... Xcode7-1.app command. Refer screenshot
open terminal -
1.Type cd drag drop your xcode (for path) then enter
2.next xattr -d com.apple.quarantine Xcode.app enter
agree for terms and condition
For Xcode 8:
To skip the verifying process on El Capitan for Xcode 8, download Xcode 8 at the developer downloads page, then open terminal.
Following this, type
xattr -d com.apple.quarantine
Then drag your xcode 8 download into your terminal window.
It should look like this:
A lot of talk here about exempting Xcode-beta.app from Gatekeeper, but for me, I had to make the .xip file exempt.
I placed Xcode_8_beta_6.xip into /Applications, then in Terminal, changed directory to /Applications and ran:
xattr -d com.apple.quarantine Xcode_8_beta_6.xip
Then double clicked the .xip to get it to unpack.
running xattr -d com.apple.quarantine Xcode.app worked like a charm. Waiting on the "verifying xcode" didn't work, as it never completed.
Also you can remove Open Warning for entire directory Applications via the command in the terminal:
xattr -d -r com.apple.quarantine ~/Applications
it's work for me:
open Terminal cd to path Xcode.app
xattr -d com.apple.quarantine Xcode.app
You can try the command:
xattr -r -d com.apple.quarantine /your_path_to_xcode/Xcode.app
If you do not use -r, you will have to run the same command for the iOS simulator later on. I am not sure what other executables are hidden in this bundle and are quarantined.
If you have time, the recommended method is to leave the verification to complete so that everything is verified properly.
I had the same issue (Macbook Pro, Mid 2015, OS X 10.11.15) and was able to fix it without using the terminal to bypass Gatekeeper:
Trash all previously downloaded versions of the file and empty the trash. (If you haven't emptied your trash in forever this may take a long time. You can selectively delete the offending .xip files manually to save time.) I found multiple instances that would not delete because they were currently in use.
Restart your computer. Now you should be able to delete any .xip files in the trash without issue.
Download the Xcode8 beta again (don't stream media while doing this to save on time and packet loss.) and open it.
If this doesn't do the trick, open up terminal and follow one of the answers above.
Run the following command making sure this is your Xcode's location on the system & replace the xcode name with actual name which code be xcode2 or Xcode 3 incase if you have more versions of Xcode on your machine..
All the best ..
xattr -d com.apple.quarantine Xcode.app
Just wait for process to get over with.. sometimes it takes longer than the usual time but ends up showing the alert boxes for next process! sit back let it finish. :)
If you are not logged in to Xcode try logging in with any Apple account.

Emulate Run button in Xcode from command line

I'm looking for a way to build and run my app in the simulator from the command line. I need it to behave the same way as when you press Run in xcode.
I can build it with xcodebuild and I tried using simulator with -SimulateApplication option. My app launched but my tests didn't start executing (as they do when run from xcode).
I tried the script I found here and few other AppleScripts I found on the web. They didn't work for me. Commands like build and clean were ignored and others would throw errors. Maybe it's because I use xcode 4. Please help.

Resources