Category: macOS

macOS (previously Mac OS X and later OS X) is a proprietary graphical operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple’s Mac computers.

  • Sync your Macs with iCloud

    Sync your Macs with iCloud

    As a software developer, I always strive to streamline my workflow and maximize the tools at my disposal. One of the challenges I faced was synchronizing my Macs with various Integrated Development Environments (IDEs) and editors I used for different projects, especially all the snippets I have been collecting for the last 10 years.

    Mainly I use Xcode, Android Studio, and VS Code. VSCode for Laravel or Django, most of the time.

    I always used two different Macs one for home and one for when I’m away. When I travel I always use my Macbook Air, and Macbook Pro when not traveling. Whenever I open my other Mac I always have the latest code snippets and configuration files.

    Here are a few tips to sync different tools between your Macs using iCloud. I don’t use any other file-sharing stuff on my Mac.

    Change {USERNAME} with your username.

    Sync AndroidStudio

    ln -s /Users/{USERNAME}/Desktop/android/AndroidStudio/AndroidStudio2023.2 /Users/{USERNAME}/Library/Application\ Support/Google

    Sync Xcode

    ln -s /Users/{USERNAME}/Desktop/Xcode/UserData /Users/{USERNAME}/Library/Developer/Xcode/

    DBeaver Community Edition

    ln -s /Users/{USERNAME}/Desktop/mysql/General /Users/{USERNAME}/Library/DBeaverData/workspace6/

    Bookmark this page for the future I might sync more stuff in my Macs.

    Spread the love
  • Bring macOS app to front when dock icon gets clicked

    Bring macOS app to front when dock icon gets clicked

    Implement applicationShouldHandleReopen in your AppDelegate

    func applicationShouldHandleReopen(_ sender: NSApplication,
                                           hasVisibleWindows flag: Bool) -> Bool {
            // Bring app window when dock icon gets clicked
            if !flag {
                for window: AnyObject in sender.windows {
                    window.makeKeyAndOrderFront(self)
                }
            }
            
            return true
    }
    Spread the love
  • macOS app basic entitlements file

    macOS app basic entitlements file

    Recently, I have submitted a macOS app on the app store where I used this entitlements file. This uses sandbox, allowing the app to call API to a remote server and select files from the user computer.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>com.apple.security.app-sandbox</key>
    	<true/>
    	<key>com.apple.security.files.user-selected.read-only</key>
    	<true/>
    	<key>com.apple.security.network.client</key>
    	<true/>
    	<key>com.apple.security.personal-information.photos-library</key>
    	<false/>
    </dict>
    </plist>
    
    Spread the love