
color.cfg라는 파일을 찾기 위해 find 명령을 사용하려고 했습니다(라텍스용 구성 파일입니다). 내 코드는 다음과 같습니다.
Yichens-MacBook-Pro:~ apple$ sudo find / -name "color.cfg"
/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/color.cfg
/usr/local/texlive/2020/texmf-dist/doc/generic/pgf/version-for-dvisvgm/en/color.cfg
find: /Library/Caches/com.apple.aned: Operation not permitted
find: /System/Library/Templates/Data/private/var/db/oah: Operation not permitted
/System/Volumes/Data/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/color.cfg
/System/Volumes/Data/usr/local/texlive/2020/texmf-dist/doc/generic/pgf/version-for-dvisvgm/en/color.cfg
find: /System/Volumes/Data/.Spotlight-V100: No such file or directory
find: /System/Volumes/Data/net: No such file or directory
find: /System/Volumes/Data/boot: No such file or directory
find: /System/Volumes/Data/.PKInstallSandboxManager-SystemSoftware: No such file or directory
find: /System/Volumes/Data/.adobeTemp: No such file or directory
find: /System/Volumes/Data/Network: No such file or directory
find: /System/Volumes/Data/Library/Caches/com.apple.aned: Operation not permitted
find: /System/Volumes/Data/System/Library/Templates/Data/private/var/db/oah: Operation not permitted
find: /System/Volumes/Data/mnt: No such file or directory
find: /System/Volumes/Data/.fseventsd: No such file or directory
find: /System/Volumes/Data/private/var/networkd/db: Operation not permitted
find: /System/Volumes/Data/private/var/db/appinstalld: Operation not permitted
find: /System/Volumes/Data/private/var/db/fpsd/dvp: Operation not permitted
find: /System/Volumes/Data/private/var/db/installcoordinationd: Operation not permitted
find: /System/Volumes/Data/private/var/db/oah: Operation not permitted
find: /System/Volumes/Data/private/var/db/lockdown: Operation not permitted
find: /System/Volumes/Data/private/var/db/KernelExtensionManagement/Staging: Operation not permitted
find: /System/Volumes/Data/private/var/db/DifferentialPrivacy: Operation not permitted
find: /System/Volumes/Data/private/var/db/MobileIdentityService: Operation not permitted
find: /System/Volumes/Data/private/var/db/searchparty: Operation not permitted
find: /System/Volumes/Data/private/var/db/CoreDuet/Knowledge: Operation not permitted
find: /System/Volumes/Data/private/var/db/ConfigurationProfiles/Store: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/SafariFamily: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.ScreenTimeAgent/Store: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.lockoutagent: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.progressd/ClassKit: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.exchangesync: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.Safari/SafariFamily: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.LaunchServices.dv: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/dmd: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.nsurlsessiond: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.SharedWebCredentials: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.routined: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/C/com.apple.WebKit.WebContent.Sandbox: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/C/com.apple.QuickLook.thumbnailcache: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/C/com.apple.WebKit.Networking.Sandbox: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/C/com.apple.quicklook.ThumbnailsAgent/com.apple.QuickLook.thumbnailcache: Operation not permitted
find: /System/Volumes/Data/private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/C/com.apple.WebKit.GPU.Sandbox: Operation not permitted
find: /System/Volumes/Data/private/var/folders/zz/zyxvpxvq6csfxvn_n00000sm00006d/0: Operation not permitted
find: /System/Volumes/Data/private/var/folders/zz/zyxvpxvq6csfxvn_n00000sm00006d/C: Operation not permitted
find: /System/Volumes/Data/private/var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/0/com.apple.nsurlsessiond: Operation not permitted
find: /System/Volumes/Data/private/var/folders/zz/zyxvpxvq6csfxvn_n00000z000007r/0/com.apple.nsurlsessiond: Operation not permitted
find: /System/Volumes/Data/private/var/folders/zz/zyxvpxvq6csfxvn_n00000z000007r/0/com.apple.routined: Operation not permitted
find: /System/Volumes/Data/private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.LaunchServices.dv: Operation not permitted
find: /System/Volumes/Data/private/var/protected/trustd/private: Operation not permitted
find: /System/Volumes/Data/.DocumentRevisions-V100: No such file or directory
find: /System/Volumes/Data/dev/fd/3: Not a directory
find: /System/Volumes/Data/dev/fd/4: Not a directory
find: /System/Volumes/Data/dev/fd/6: Not a directory
find: /System/Volumes/Data/.PreviousSystemInformation: No such file or directory
find: /System/Volumes/Data/.TemporaryItems: No such file or directory
find: /System/Volumes/iSCPreboot: No such file or directory
find: /System/DriverKit: No such file or directory
find: /private/var/networkd/db: Operation not permitted
find: /private/var/db/appinstalld: Operation not permitted
find: /private/var/db/fpsd/dvp: Operation not permitted
find: /private/var/db/installcoordinationd: Operation not permitted
find: /private/var/db/oah: Operation not permitted
find: /private/var/db/lockdown: Operation not permitted
find: /private/var/db/KernelExtensionManagement/Staging: Operation not permitted
find: /private/var/db/DifferentialPrivacy: Operation not permitted
find: /private/var/db/MobileIdentityService: Operation not permitted
find: /private/var/db/searchparty: Operation not permitted
find: /private/var/db/CoreDuet/Knowledge: Operation not permitted
find: /private/var/db/ConfigurationProfiles/Store: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/SafariFamily: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.ScreenTimeAgent/Store: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.lockoutagent: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.progressd/ClassKit: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.exchangesync: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.Safari/SafariFamily: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.LaunchServices.dv: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/dmd: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.nsurlsessiond: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.SharedWebCredentials: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/0/com.apple.routined: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/C/com.apple.WebKit.WebContent.Sandbox: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/C/com.apple.QuickLook.thumbnailcache: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/C/com.apple.WebKit.Networking.Sandbox: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/C/com.apple.quicklook.ThumbnailsAgent/com.apple.QuickLook.thumbnailcache: Operation not permitted
find: /private/var/folders/ys/nkcxlbwj4qldtphp_278zpbw0000gn/C/com.apple.WebKit.GPU.Sandbox: Operation not permitted
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000sm00006d/0: Operation not permitted
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000sm00006d/C: Operation not permitted
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/0/com.apple.nsurlsessiond: Operation not permitted
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000z000007r/0/com.apple.nsurlsessiond: Operation not permitted
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000z000007r/0/com.apple.routined: Operation not permitted
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.LaunchServices.dv: Operation not permitted
find: /private/var/protected/trustd/private: Operation not permitted
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
find: /dev/fd/6: Not a directory
보시다시피 화면에 "작업이 허용되지 않음" 오류와 "디렉토리가 아님" 오류가 표시되어 필요한 파일을 검색할 수 없습니다.
이 솔루션은 작동하지 않습니다이미 터미널에 전체 디스크 액세스 권한을 부여했기 때문입니다.
답변1
디렉토리는 시스템과 관련되어 있으므로 사용자에게 콘텐츠를 읽을 수 있는 권한이 없을 것으로 예상됩니다. 터미널 에뮬레이터에 전체 디스크 액세스 권한을 부여해도 변경되지 않으며 이는 엄청난 보안 위험이 됩니다.
모든 Unix 기반 및 대부분의 다른 OS에서 작동하는 또 다른 솔루션이 있습니다.
리디렉션 오류 출력
일반적으로 Unixoidal 운영 체제에서는 리디렉션할 수 있습니다.표준 오류를 추가하여 터미널 표준 출력을 복잡하게 만들지 않도록 파일에 2> /somefile
.
예:
sudo find / -name "color.cfg" 2> /dev/null