如何修复权限以允许 IntelliJ IDEA 运行 Kotlin 脚本?

How do I fix permission to allow IntelliJ IDEA to run a Kotlin script?

我正在尝试 运行 来自 IntelliJ IDEA 2020.3.1 的以下 Kotlin 脚本 Mac OS 10.15.7。终端中的脚本 运行 没问题,但是当我点击 IntelliJ 中的 'run' 按钮时,出现以下错误:

zsh:权限被拒绝:/Users/*****/scripts/first.main.kts

解决此权限问题的正确方法是什么?

#!/usr/bin/env kotlin

@file:Repository("https://jcenter.bintray.com")
@file:DependsOn("org.http4k:http4k-bom:4.1.1.2")
@file:DependsOn("org.http4k:http4k-core:4.1.1.2")
@file:DependsOn("org.http4k:http4k-client-apache:4.1.1.2")
@file:DependsOn("org.http4k:http4k-server-netty:4.1.1.2")


import org.http4k.client.ApacheClient
import org.http4k.core.Method
import org.http4k.core.Request


val client = ApacheClient()

val request = Request(Method.GET, "https://api.kanye.rest/").query("format", "text")

println(client(request))

您必须使文件可执行:chmod +x first.main.kts