Skip to content

Instantly share code, notes, and snippets.

@sangheonhan
Created May 3, 2024 05:15
Show Gist options
  • Save sangheonhan/d05c11447fdb7f5fac97c0b678ebd1a2 to your computer and use it in GitHub Desktop.
Save sangheonhan/d05c11447fdb7f5fac97c0b678ebd1a2 to your computer and use it in GitHub Desktop.
List Installed Mac Applications
#!/bin/bash
# 파일을 저장할 경로 설정
output_file=~/Desktop/Installed_Applications_Names.txt
# 출력 파일이 이미 존재한다면 삭제
rm -f $output_file
# /Applications 폴더 내의 모든 .app 항목에 대해 반복
for app in /Applications/*.app; do
# Info.plist 파일의 경로
plist="$app/Contents/Info.plist"
# CFBundleName 값을 추출
app_name=$(defaults read "$plist" CFBundleName 2>/dev/null)
# 추출된 이름을 파일에 추가
if [ -n "$app_name" ]; then
echo "$app_name" >> $output_file
else
# CFBundleName이 없는 경우, 폴더 이름을 사용
echo "$(basename "$app" .app)" >> $output_file
fi
done
echo "Installed applications' names have been saved to $output_file."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment